- Flowchart :
- Syntax :
if (condition1) { // Executes when condition1 is true if (condition2) { // Executes when condition2 is true } }
- Program :
#include <stdio.h>
#include<conio.h>
void main()
{
int a;
clrscr();
printf("\n----------------NESTED IF STATEMENT----------------");
printf("\nEnter Your Age :");
scanf("%d",&a);
if(a<18)
{
printf("\nYou are Minor");
printf("\nNot Eligible to Work");
}
else
{
if(a>=18 && a<=60)
{
printf("\nYou are Eligible to Work");
printf("\nPlease fill in your details and apply");
}
else
{
printf("\nYou are too old to work as per the Government rules");
printf("\nPlease Collect your pension!");
}
}
getch();
}
- Output :
No comments:
Post a Comment