Write a program to Find out Maximum Number: C Program

0
1954

In this program (Find out maximum number: C Program), user is asked to enter three numbers and this program will find the largest number among three numbers entered by user. This program can be solved in more than one way.But here this program  using  nested if-else statement.

Find out maximum number
Flowchart

[message_box title=”Program ” color=”red”]

 

/* Write a program to read three numbers from keyboard and find out maximum out of these three */

/* Written by Utpal Chaudhary */

/*Student of L.D COLLEGE OF ENGINEERING,Ahmedabad-15,Gujarat */

#include <stdio.h>
#include <conio.h>

void main()
{
int a, b, c;

clrscr();

printf (” Enter three Numbers =”);

scanf(“%d %d %d “,&a,&b,&c);

if(a > b)
{
if(a > c)
{
printf (“%d is maximum”,a);
}
else
{
Printf(“%d is maximum”,c);
}
}
else
{
if(b > c);
{
printf (“%d is maximum”,b);
}
else
{
printf (“%d is maximum”,c);
}
}
getch();

}

[/message_box]

[message_box title=”Output” color=”red”]
Enter three Numbers = 25  30  40

40 is maximum
[/message_box]