If statement: The condition evaluates to either true or false. True is always a

If statement:
The condition evaluates to either true or false. True is always a

If statement:
The condition evaluates to either true or false. True is always a non-zero value, and false is a value that
contains zero. Instructions can be a single instruction or a code block enclosed by curly braces { }.
Program :
#include
int main()
{
int num1=1;
int num2=2;
if(num1
int main()
{
int num=19;
if(num<10) { printf("The value is less than 10"); } else { printf("The value is greater than 10"); } return 0; } Output: The value is less than 10 nested if statements : Syntax : if(condition) { if(condition) { here goes statements; } } Program #include
int main()
{
int num=1;
if(num<10) { if(num==1) { printf("The value is:%dn",num); } else { printf("The value is greater than 1"); } } else { printf("The value is greater than 10"); } return 0; } Output: The value is:1 Nested Else-if statements : if (test - expression 1) { statement1; } else if (test - expression 2) { Statement2; } else if (test - expression 3) { Statement3; } else if (test - expression n) { Statement n; } else { default; } Statement x; #include
int main()
{
int marks=83;
if(marks>75){
printf(“First class”);
}
else if(marks>65){
printf(“Second class”);
}
else if(marks>55){
printf(“Third class”);
}
else{
printf(“Fourth class”);
}
return 0;
}
Output:
First class

× How can I help you?