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
should i put define constant and memory constant in my flowchart? the other one, how to draw flowchart for break and continue statement?

Write a program to print all the factors of a positive integer A

A: Along with the C++ language, you can overload operators and functions. Overloading is the practice of supplying more than one definition for a provided function name in the same

Yes. "Memory pools" are useful in many situations. The bad news is that I'll need to drag you through the mire of how it acts before we talk about all the uses. Firstly, recall

Constructors and Destructors: A Class is defined as constructor by declaring a constructor in the form of function inside the class.  In other word a function in the name of

Working Ordered linked list: • Eachinteger in the queue is stored inside of a QueueItem. The QueueItem contains the integer, and a pointer to the next item in the queue. Fo


Incomplete types refer to pointers in which there is no availability of the execution of the referenced location or it points to some location whose value is not available for modi

Given an integer n and a permutation of numbers 1, 2 ... , n-1, n write a program to print the permutation that lexicographically precedes the given input permutation. If the given

write a java program padovan string program in java // aakash , suraj , prem sasi kumar kamaraj college program 1 : package test.padovanstring; public class Pado