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.
- Declare the variable.
- Using methods.
- 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();
}