Largest number C program

It’s a largest number C program that inputs any numbers from the user, then use largest number condition to find the largest number among them, and print result on the screen.

To understand this program, it’s better you should know the following topics:

Program (1): to find the largest number among the five numbers.

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,d,e,lar;
printf("Enter any five numbers : ");
scanf("%d %d %d %d %d",&a,&b,&c,&d,&e);
lar=a;
if(b>lar)
lar=b;
if(c>lar)
lar=c;
if(d>lar)
lar=d;
if(e>lar)
lar=e;
printf("The largest number is %d",lar);
getch();
}

Output (1)

Enter any five numbers : 143
12
334
9
14
The largest number is 334

Published by

Electrical Workbook

We provide tutoring in Electrical Engineering.

Leave a Reply

Your email address will not be published. Required fields are marked *