Module- 3
Control Statements
a. Conditional Control statements – if, if else, Nested if, switch case
b. Loop control statements – for, while, do while
break and continue statements
, Control Structures in C
• Conditional Control/Decision control Statements in C
1. If , if else, Nested if else
2. switch case
• Loop Control statements in C
1. for loop
2. while loop
3. do.. while
• break and continue statements
, Decision Control statements in C
A. Decision Control Statements
1. if statement: (first form)
Syntax : if (expression)
statement 1;
statement2:
Explanation :
Here, expression is boolean expression. It may result in true or false value. If expression is
executes the statement1 otherwise the control jumps to next instruction. Non-Zero Numb
means “TRUE Condition”.
Sample Program :
#include<stdio.h>
void main()
{
int a=5,b=6,c;
c=a+b;
if (c==11)
printf("Execute if");
printf("Execute second printf");
}
Control Statements
a. Conditional Control statements – if, if else, Nested if, switch case
b. Loop control statements – for, while, do while
break and continue statements
, Control Structures in C
• Conditional Control/Decision control Statements in C
1. If , if else, Nested if else
2. switch case
• Loop Control statements in C
1. for loop
2. while loop
3. do.. while
• break and continue statements
, Decision Control statements in C
A. Decision Control Statements
1. if statement: (first form)
Syntax : if (expression)
statement 1;
statement2:
Explanation :
Here, expression is boolean expression. It may result in true or false value. If expression is
executes the statement1 otherwise the control jumps to next instruction. Non-Zero Numb
means “TRUE Condition”.
Sample Program :
#include<stdio.h>
void main()
{
int a=5,b=6,c;
c=a+b;
if (c==11)
printf("Execute if");
printf("Execute second printf");
}