#include <stdio.h>
int main()
{
// 10. Write a program to read three numbers from keyboard and find out maximum out of these
// three. (nested if else)
printf("\tFind Maximum Value");
printf("\n==============================");
float a, b, c;
printf("\n\nEnter The Value Of A : ");
scanf("%f", &a);
printf("\nEnter The Value Of B : ");
scanf("%f", &b);
printf("\nEnter The Value Of C : ");
scanf("%f", &c);
printf("\n_______________________________\n\n");
if (a > b)
{
if(a > c){
printf("A Has Maximum Value");
}
else
{
printf("C Has Maximum Value");
}
}
else if (b > a)
{
if(b > c){
printf("B Has Maximum Value");
}
else
{
printf("C Has Maximum Value");
}
}
printf("\n_______________________________\n\n");
return 0;
}
if-else
statements.printf
statements. It then takes the user inputs using the scanf
function.if-else
statements. If a
is greater than b
, it checks if a
is greater than c
. If it is, it prints "A Has Maximum Value". Otherwise, it prints "C Has Maximum Value". Similarly, if b
is greater than a
, it checks if b
is greater than c
. If it is, it prints "B Has Maximum Value". Otherwise, it prints "C Has Maximum Value".