#include<stdio.h>
#include<conio.h>
void input(int arr[],int);
void display(int arr[],int);
void selectionsort(int arr[],int n);
void main()
{
int arr[10],n;
clrscr();
printf("Enter size of array=");
scanf("%d",&n);
input(arr,n);
display(arr,n);
printf("\nAfter arranging the array is=");
selectionsort(arr,n);
display(arr,n);
getch();
}
void input(int arr[],int n)
{
int i;
for(i=0;i<n;i++)
{
printf("\nEnter element=");
scanf("%d",&arr[i]);
}
}
void display(int arr[],int n)
{
int i;
printf("\nThe array is=");
for(i=0;i<n;i++)
{
printf("\n%d",arr[i]);
}
}
void selectionsort(int arr[],int n)
{
int min,loc,temp,j,i;
for(i=0;i<n-1;i++)
{
min=arr[i],loc=i;
for(j=i+1;j<n;j++)
{
if(arr[j]<min)
{
min=arr[j],loc=j;
}
temp=arr[i];
arr[i]=arr[loc];
arr[loc]=temp;
}
}
}



PROVIDE THE ON DEMAND PROJECTS EITHER THEY ARE DOMESTIC, COLLEGE PROJECTS, OR COMMERCIAL PROJECTS. YOU WILL GET THE PROJECT COMPLETELY ACCORDING TO YOUR REQUIREMENTS. CONTACT US AT :- knowledgeforyou2022@gmail.com

Leave a Reply

Your email address will not be published.