2. if
C Syntax Flowchart
if (condition) START
{
statement1;
: true
condition
statementN;
} false Statement
• condition Statement
int
• {} END
condition
• 2
3. if
#include <stdio.h> if1.c
int main()
{ YOUR HAVE
int i=25,j=18; PERMITION
if(i>j)
printf(“YOUR HAVE PERMITION"
getch();
return 0;
}
3
4. if…else
Flowchart C Syntax
START if (condition)
{
true false statementt1;
condition
statementt2;
Statementt1 Statementf1
}
else
Statementt2 Statementf2 {
statementf1;
statementf2;
END }
4
5. if…else
#include <stdio.h> ifelse1.c
int main()
{
int i=17,j=18;
YOUR HAVE NOT
if(i>j) PERMITION
printf(“YOUR HAVE PERMITION");
else
printf(“YOUR HAVE NOT PERMITION");
getch();
return 0;
}
5
6. if
if (x==1)
true Action1;
x==1 Action1;
false
else if (x==2)
x==2
true
Action2; Action2;
false else if (x==3)
true
x==3 Action3; Action3;
false
true
else if (x==4)
x==4 Action4;
false
Action4;
Default_Action; else
Default_Action;
6
7. if
#include <stdio.h> ifelse2.c
int main()
{
int i=8;
MORE
if(i>7) printf(“MORE THANTHAN 7 7");
else if(i>6) printf("MORE THAN 6");
else if(i>5) printf("MORE THAN 5");
else printf("1 , 2 , 3");
getch();
return 0;
}
7