by Dinesh Thakur Category: C Programming (Pratical)

This is c program that ask user to find out the Maximum number from given digits. User declares the required variables that use to contain the value in it. User ask to enter any five values then for loop will come in exist for evaluate the condition then if condition will use to evaluate that which number is minimum and which is maximum. Then display the result on screen as output.

Problem Statement
This is C program that ask user to find the maximum and minimum number.

  1. Declare the variable.
  2. Using methods.
  3. Display result on the screen.

Here is C source code to find maximum and minimum number. The output of this program shown below. 

#include<stdio.h>
void main()
{
      int a[5],i,max=0,min=0;
      clrscr();
      printf("Enter Five Value :");
      for(i=0;i<=4;i++)
          {
               scanf("%d",&a[i]);
          }
      for(i=0;i<=4;i++)
          {
              if(a[i]>max)
               {
                    max=a[i]; 
                   
               }
              else
               {
                    min=a[i];
                   
               }
                   
           }
                    printf("Minium is : %d\n",min);
                    printf("Maximum is : %d\n",max);
                    getch();

Find the Max Number



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.