Breaking News
Loading...

Bubble short Ascending in c


#include<stdio.h>
void main()
      {
           int i,j,n,temp,a[100];
           clrscr();
           printf("Enter how many number do you Enter");
           scanf("%d",&n);
           printf("Enter number");
           for(i=0;i<n;i++)
                 scanf("%d",&a[i]);
           for(j=0;j<n;j++)
                {
                     for(i=j+1;i<n;i++)
                          {
                                 if(a[j]>a[i])
                                   {
                                         temp=a[j];
                                         a[j]=a[i];
                                         a[i]=temp;
                                   }
                          }
              }
       printf("Ascending order is: ");
       for(i=0;i<n;i++)
             printf("%d,",a[i]);
       getch();
}

0 comments:

Post a Comment

:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.

 
Toggle Footer