Menu:

ADA (8) OOT (5)

Tuesday, April 12, 2016

Program to do bubble sort using C

#include<stdio.h>
int main()
{
int a[10]={1,4,3,7,8,3,9,4,9,5};
int i,j,t;





for(i=0;i<10;i++)
{
for(j=i+1;j<10;j++)
{
if(a[i]>a[j])
{
t=a[i];
a[i]=a[j];
a[j]=t;
}
}
}
for(i=0;i<10;i++)
{

printf("%d",a[i]);
}
return 0;
}

No comments:

Post a Comment