C PROGRAM ON BUBBLE SORT
#include<stdio.h>
#include<conio.h>
#define max 10
void main()
{
int a[max],i,n;
printf("Bubble sort:");
printf("======\n");
printf("enter no.of integers:");
scanf("%d",&a[i]);
printf("\n enter %d integer:",n);
for(i=0;i<n;i++)
scanf("%d",a[i]);
bubble(a,n);
printf("\n\n elements before sorting:");
scanf("%d",&n);
printf("\n\n elements after sorting:");
scanf("%d",&n);
{
int i,j,temp;
int x[1];
{
for(i=0;i<n-1;i++)
{
for(j=0;j<n-1;j++)
{
if(x[i]>x[j+1]);
}
temp=x[j];
x[j]=x[i];
x[i]=temp;
}
}
}
}
No comments:
Post a Comment