Program for Sorting of n Elements in an Array

# include <stdio.h>
#include<conio.h>
main( )
{
int a [10], n, i, k,j;
printf (“enter size of an array”);
scanf ( “%d“, &n);
printf (“enter elements into an array”);
for ( i = 0; i < n ; i ++)
scanf (“%d”, &a[i]);
for  ( i = 0; i < n; i ++ )
{
   for ( j = i+1; j
   {
     if (a [i] > a [j])
      {
        k = a [i];
        a[i] = a[j];
        a [j] = k;
      }
    }
}
printf (“after sorting values are”);
for ( i = 0; i < n; i ++)
printf (“%d \n”, a [i]);
getch();

}

Related

C Programs 1727368900029044128

Post a Comment

emo-but-icon
:noprob:
:smile:
:shy:
:trope:
:sneered:
:happy:
:escort:
:rapt:
:love:
:heart:
:angry:
:hate:
:sad:
:sigh:
:disappointed:
:cry:
:fear:
:surprise:
:unbelieve:
:shit:
:like:
:dislike:
:clap:
:cuff:
:fist:
:ok:
:file:
:link:
:place:
:contact:

item