Feed Headline Animator

The array of 5 element in the main function and call a function to sort the given the array and the sorted list will be displayed in the main function

Main()
{
int n[5],I;
for(i=0;i<=4;i++)
{
printf(“Enter the number\n”);
scanf(“%d”,&n[i]);
}
sorting(n[0]);
printf(“The sorted list\n”);
for(i=0;i<=4;i++)
printf(“%d\n”,n[i]);
getch();
}
sorting (int *k)
{
int I,j,t;
for(i=0;i<4;i++)
for(j=i+1 ;j<=4 ;j++)
if(*(k+i)>* (k+j ))
{
t=*(k+I );
*(k+i)=*(k+j);
*(k+j )=t;
}
}


Posted by: Wasim Javed

No comments:

Post a Comment