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

CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials 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 Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz