Subscribe to Feeds

Send Your Projects To georgepj@hotmail.com

We'll Publish It With Your Name :-)

Programs Can Also Be Downloaded From The Folders Below....[Or Scroll Down]

Bubble Sort

Click Here To Download C File Of This Program

 //BUBBLE Sort 
//Downloaded from www.c4cprog.co.nr
#include<conio .h>
void sort(int a[],int n)
{
int i,j,b;
printf("\nSorted Array :");
for(i=0;i<n;i++)
for(j=0;j<n-1;j++)
if(a[j]>a[j+1])
{
b=a[j];
a[j]=a[j+1];
a[j+1]=b;
}
for(i=0;i<n;i++)
printf("\n%d",a[i]);
}
void main()
{
int n,a[100],i;
clrscr();
printf("Enter Limit :");
scanf("%d",&n);
printf("\n\nEnter Array :\n");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
sort(a,n);
getch();
}

0 comments:

Post a Comment