Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  bubble sorting
Language: C/C++
Code:
#include<stdio.h>
main()
{
int i,j,n,a[100],temp;
printf("enter n value");
scanf("%d",&n);
printf("enter array values");
for(i=1;i<=n;i++)
{
scanf("%d",&a[i]);
}
for(j=0;j<n-1;j++)
{
 for(i=0;i<n;i++)
 {
  if(a[i]<a[i+1])
  {
   temp=a[i];
   a[i]=a[i+1];
   a[i+1]=temp;
  }
 }
}
for(i=0;i<n;i++)
{
printf("%d",&a[i]);
}
}
          
          
          
Comments: