Programming Examples

Write a program to detect the largest number out of five numbers and display it


Write a program to detect the largest number out of five numbers and display it?

Solution

#include<stdio.h>
#include<process.h>
void main()
{
int a,b,c,d,e,sum=0,i;
clrscr();
printf(“\nEnter Five numbers :”);
scanf(“%d %d %d %d %d”,&a,&b,&c,&d,&e);
sum=a+b+c+d+e;
for(i=sum; i<=sum;i–-)
{
 if(i==a || i==b || i==c || i==d || i==e)
 {
 printf(“The Largest Number : %d”,i);
 exit(0);
 }
}
}
Output

OUTPUT:

Enter Five numbers : 5 2 3 7 3

The Largest Number : 7

Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2026 Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Best Website and Software Company in Allahabad