Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

rrange the numbers into lowest to highest

$
0
0
i cant figure out my error .actually my code have not error.just look at the picture


...here's my code
#include<stdio.h>
#include<conio.h>
main()
{
      const int Size = 12;
      int contain[Size];
     printf("\n enter  number:\n");   
      for(int i=0;i<Size;i++)
      scanf("%d",& contain[i]);
  {    
                      
                      int l , h;
                      for(l = 0 ; l<12-1; l++)
                      for(h=l+1 ; h<12; h++)
                      if(contain[l] < contain[h])
                      { int temp;
                                    
                                    temp = contain[l];
                                    contain[l]= contain[h];
                                    contain[h] = temp;
                           
                         }
                                                  
                         for(int k = 0 ; k<12; k++)
                         printf("\nAscending number %d\n\t", contain[k]);
                        printf("\n\nLowest is %d\t\Highest is %d \n\t" ,contain[l],contain[h]);
                         getch();
                       }  }


Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>