Nested IF statement in C program
Hi Noel, C is a programming language that is developed at AT & T's Bell Laboratories of USA in 1972 by Dennis Ritchie who Designed and written it completely and C became popular due to its ease of use and advantages.
Coming to If statements we generally use if condition for checking the decision made by the condition and the syntax for if is follows as given by..
if(condition)
statement;
Here condition refers to " 5>10 " then if the statement is true then it returns print statement and if not satisfied then else is used to print statement next to else if not satisfied.
Example is defined as..
if(5>10)
{
printf("good");
}
else
{
printf("bad");
}
Here the output will be printed as bad as the condition is not satisfied and if it is " 5<10" then it will be printed as good as the condition is satisfied.
Thank You.
Nested IF statement in C program
Hi there ,Â
It seems you need details on what is nested if s .Â
A nested if is a special kind of if that has another if in its body or in inside its else body.
An example of the nested if is as follows :-Â
if(expression1 )Â
{
:
if(expression2 )Â
statement 1 ;
elseÂ
statement 2 ;
}
elseÂ
body of else ;
Nested ifs can be a little bit of confusing but with little logic and pure thinking you can handle that in ease. All you need is concentration. Nested ifs can be used for a lot variety of programs like writing a code to test a number whether it is positive or negative or zero.
Good luck
Nested IF statement in C program
Thank you for the explanations given about the C language.
Thanks Hoting Gracia. Thanks Lesten Pasio.
Thanks TechyV.