Selection Sort in C Program Tamil


//	Selection Sort
#include<stdio.h>
#include<conio.h>
void main()
{
	int a[10],i,j,t;
	clrscr();	// Clears the Output Screen
	printf("\n Enter the 10 Values :");
	for(i=0;i<=9;i++)
		scanf("%d",&a[i]);
	for(i=0;i<=8;i++)
	{
		for(j=i+1;j<=9;j++)
		{
			if(a[i]>a[j])	//Compare an Element a[i] with all elements a[j] one by one
			{
				t=a[i];    // Interchanging Values
				a[i]=a[j];
				a[j]=t;
			}
		}
	}
	printf("\n Sorted Elements are :");
		for(i=0;i<=9;i++)
		{
			printf("\n%d",a[i]);	//Sorted Elements
		}
	getch();
}

Login To Download Source Code

Leave a Comment:

Login To Comment

List Of Programs


Goto Examples

Operators

Looping

Number Conversion

Pattern Design

Arrays

Matrix Examples

Sorting Examples

String Function

Change Case

String In C

Maths Functions

User Defined Functions

Recursive Functions

Pointer

Structure

File Concept

Calender Programming