PROGRAM TO SORT 10 ELEMENTS USING BUBBLE SORT


#include<stdio.h>
#include<conio.h>
void main()
{
long int i,j,tmp,a[10];
for(i=0;i<n;i++)
printf("enter nos.\n");

for(i=0;i<10;i++)
scanf("%ld",&a[i]);

for(i=0;i<10;i++)
{
for(j=0;j<9;j++)
if(a[j]>a[j+1])
{
tmp=a[j];
a[j]=a[j+1];
a[j+1]=tmp;
}
}
printf("sorted array is -->\n");
for( i=0;i<10;i++)
printf("%ld\n",a[i]);
getch();
}

SIMPLE PROGRAMS
FUNCTIONS


NUMBERS


STRINGS AND CHARACTERS

Comments