Professional Documents
Culture Documents
C - Programming
C - Programming
BY APTUTS.COM
EMAIL: LEARN@APTUTS.COM
ABOUT ME
Bachelor's Degree in Computer Science Engineering
Software Engineer in IT Industry & Teaching Experience
7 Years of IT experience in various technologies
Expertise in C, C++, Application Development, Manual Testing, Web Automation Testing, Mobile
Automation Testing, Website Designing, PHP and VBScript
Founder of LearnCOnline.com, LearnCPPOnline.com and Aptuts.com
Contact Info: prashant@aptuts.com
Altered Flow
Step 1
Step 1
Step 2
Step 2
Step 3
Step 3
CONTROL STATEMENTS IN C
Control statements alter the flow of execution of the programs. Control statements can be broadly
divided into three categories:
1. Decision-making or Conditional Statements
2.
Loop Statements
3.
if statement
if-else statement
switch statement
for statement
while statement
do-while statement
break statement
continue statement
goto statement
CONTROL STATEMENTS IN C
if conditional statement
if statement is used to express the conditional expressions.
If the given condition is true then it will execute the
statements otherwise it will skip it and execute the
optional statements
int a = 10;
if (a == 10){
printf(You are in if block\n);
printf(The value of a is %d\n, a);
}
printf(You are out of if block);
Syntax:
if (condition is true){
/*block of statements to be executed*/
}
Output:
You are in if block
The value of a is 10
You are out of if block
DEMO OF IF STATEMENT
Let us write and run a simple C program to demonstrate how if statement works.
Scenario:
Note:
We will be using if decision control statement to write the above program
THANK YOU
Web: www.aptuts.com
Email: learn@aptuts.com
Social: www.facebook.com/aptuts