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
Q: But MFC appear to encourage the employ of catch-by-pointer; should I do the similar? A: Depends. If you're utilizing MFC and catching one of their exceptions, by all means, d

i want software to calculate heating or use thermodynamic equation , pleas help me

Purchasing Code Signing Certificate I want to purchase a Code Signing Certificate in good standing from someone in order to sign my .EXE programs with. Please be aware I do n

Buddy systems : A method of handling the storage management problem is kept individual free lists for blocks of dissimilar sizes. Every list having free blocks of only one particul

d county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Necklaces


First line starts with T, number of test cases. Each test case T contains a necklace (N).

Rules for overloading an operator This summarizes the most significant points you need to know in order to do operator function overloading. The only operators you may o

A: The procedure of encoding the parameter types along with the function/method name into a unique name is called as name mangling. The inverse procedure is called demangling. F

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b