Tuesday, 1 November 2016

bubble sort using c

Tags

#include<stdio.h>
#include<conio.h>
void main()
{


int a[20],i,j,temp,n;
printf("\n enter array size");
scanf("%d",&n);
printf("array elements are:\n",n);
for(i=0;i<n:i++)
printf("\n%d",a[i]);
for(i=0;i<=j;i++)
for(i=0;i<=j;i++)
if(a[i]>a[i+1])
{
temp=a[i];
a[i]=a[i+1];
a[i+1]=temp;
}
printf("\n after sorting:\n");
for(i=0;i,n;i++)
printf("\n%d",&a[i]);
}
getch();