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
Define  T y pe c o m p a t i b i li t y? T o a s s i g n i n t t o s m a l l i n t t h e v a r i a b l e should b e

# Dear I want help to programmer that write C++ code for my small project as soon as posible If we can help me?..

write a program to find the area under the curve y=f(x) between x=a & x=b

Create a pseudocode in getting Calendar Quarter. The program should identify which quarter falls the given date. Note: Consider the date format DDMMYYYY.

A: Method of passing arguments to a function that takes parameter of type reference.  for instance: void swap( int & x, int &amp;amp; y ) { int temp = x; x =

Program is to define a class as employee: Write a program to define a class as employee and collect information about them by using classes and object class employee   {

What are  Id e n t i f ie rs a n d C o n s t a n ts in C++? Id e n t i f ie r a n d C o n s t a n t : I d e n t i f ie r

Problem #1: plugging the memory leak. When you employ the "normal" new operator, for example Foo* p = new Foo(), the compiler generates some special code to manage the case while t

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