What Is Nested If-Else Statement?
Hello Programmers,
Today we will discuss one more important clause of 'if statement'. Today we will discuss 'nested if-else' statement this is one more important clause in 'if statement'. In the last blog, we studied 'if-else' statement and today we will discuss one more statement that is 'nested if-else statement'.
Definition:
Syntax:-
Program To Select And Print The Largest Of Three Float Number:
#include<stdio.h>
#include<conio.h>
int main()
{
float a,b,c;
printf("Enter Three Value ");
scanf("%f%f%f",&a,&b,&c);
printf("\n Largest Value is: ");
if(a>b)
{
if(a>c)
{
printf("%f",a);
}
else
{
printf("%f",c);
}
else
{
if(b>c)
{
printf("%f",b);
}
else
{
printf("%f",c);
}
}
getch();
}
Output:
Enter Three values: 9.12 5.34 3.87
Largest Value is: 9.12
Sharing Is Caring...
Comments :
Post a Comment