Table of Contents
show
Nested if statement
Syntax
if(expression)
{
Statement 1
if(expression)
{
Statement 2
}
}
Flowchart
Example
#include<stdio.h>
int main()
{
int a=100;
int b=200;
if(a==100)
{
if(b==200)
{
printf("a=%d,b=%d\n",a,b);
}
}
printf("a=%d,b=%d\n",a,b);
return 0;
}
Output
a=100,b=200
a=100,b=200
Views: 0