C program for maximum no, minimum no and sorting, C/C++ Programming

  C Program for MAXIMUM NO, MINIMUM NO AND SORTING

 

void main()

{

          int i,j,t;

          int a[5];

          clrscr();

          for(i=0;i<5;i++)

          {

                   printf("ENTER THE SINGLE DIGIT= ");

                   flushall();

                   scanf("%d",&a[i]);

          }

          for(i=0;i<5;i++)

          {

                   for(j=0;j<5;j++)

                   {

                             if(a[i]>a[j])

                             {

                                      t=a[i];

                                      a[i]=a[j];

                                      a[j]=t;

                             }

                   }

          }

          printf("\n");

          for(j=0;j<5;j++)

          {

                   printf(" %d",a[j]);

          }

          printf("\nTHE MAXIMUM NUMBER IS %d\n",a[5]);

          printf("THE MINIMUM NUMBER IS %d\n",a[0]);

          getch();

}

 

OUTPUT :

ENTER THE SINGLE DIGIT : 5

ENTER THE SINGLE DIGIT : 8

ENTER THE SINGLE DIGIT : 1

ENTER THE SINGLE DIGIT : 2

ENTER THE SINGLE DIGIT : 6

8 6 5 2 1

THE MAX. NO IS : 8

THE MIN.  NO IS : 1

 

Posted Date: 9/10/2012 2:24:24 AM | Location : United States







Related Discussions:- C program for maximum no, minimum no and sorting, Assignment Help, Ask Question on C program for maximum no, minimum no and sorting, Get Answer, Expert's Help, C program for maximum no, minimum no and sorting Discussions

Write discussion on C program for maximum no, minimum no and sorting
Your posts are moderated
Related Questions
create a flowchart that display the assume that there are 3 section each student ?


Project Description: I'm seeking someone who could write me a torrent seeding client which supports multiple proxies. The goal of the project is to make torrents popular by seed


A: no, can't. The names of, precedence of, associativity of, and arity of operators is fixed through the language. In C++, there is no operator** so you cannot create one for a

how to define the structures

#questio#A Padovan string P(n) for a natural number n is defined as: P(0) = ‘X’ P(1) = ‘Y’ P(2) = ‘Z’ P(n) = P(n-2) + P(n-3), n>2 where + denotes string concate

Mathematical Statements and assignments    Within C we can directly load up the variable from within the program using the mathematical expression equates (=) e.g.   a= 'h'

minimum of seven number