My Campus in google map

My Campus Map

Jagannath University in Google Map

Advertisements

A program of bubble sort in ascending order

/* A program of bubble sort in ascending order */

#include

int main(void)
{
int i,j,n,array[50],tem;

printf(“Enter how many number are you want to sort , maximum size is 50 :\n”);
scanf(“%d”,&n);

printf(“Now Enter %d numbers :\n”,n);
for(i=0;i
scanf(“%d”,&array[i]);

for(i=1;i<=n-1;i++)
{
for(j=0;j<n-i;j++)

{

if(array[j]>array[j+1e])
{
tem=array[j];
array[j]=array[j+1];
array[j+1]=tem;

}
}
}
printf(“The sorted number are :\n”);
for(i=0;i<n;i++)
printf(“%3d”,array[i]);

return 0;
}