Protec Computer Academy (An ISO 9001:2015 Certified Institute, Powered by E-Max Education, Branch Code EMAX/EK-80503, Registered by government of India.) is a best IT training center in Siwan with 100% Job placement assistance. Where you can learn Programming, WebDesigning, Hardware|Networking, Blogging, WordPress, Digitial marketing, English Speaking, And many more...| All certificates are valid in Government Jobs as well as in Private Companies. *** At Tara Market, Beside Vishal Mega Mart - Siwan*** +917541905230, Email- ahmad.irshad781@gmail.com *** Follow us on | | @welcome2protec

Friday, November 20, 2020

Control statements in C

Control statements: used to regulate the flow of program execution, i.e., whether or not a set of statements will be executed based on certain condit

Control statements | welcome2protec.com


What is control statements in C?

Control statements are used in C or other programming language to regulate the flow of program execution, i.e., whether or not a set of statements will be executed based on certain conditions or how many times a certain block of cedes is to be executed, again based on condition.

For Example:

/*Control statements in C*/
int x = 2;
int y = 3;

/*If condition is true, this code block will be executed*/
if((x + y) % 5 == 0){
 // Do whatever
}

/*if condition is false, this code block will be executed*/
else{
 //Do something else 
}
-------------------OR----------------------------
int i;
for(i = 0; i < 10; i++){
 /* Do anything that you want. This code block will be 
  * executed until i becomes > or = to 10 */
}

There are three type of control statements in C

Decision making statement:

It is used to decide whether a certain statement or block of statements will be executed or not i.e. If a certain condition is true then a block of statement is executed otherwise not.

Types of decision making statement:

  1. Simple if statement
  2. if...else & ladder if...else statement
  3. nested if...else statement
  4. Switch...case statement

Iterative statements:

Iterative statements create loops in the program. It is the process where a set of instructions or statements is executed repeatedly for a specified numbers of time or until a condition is satisfied.

Type of iteration statement in C:

  1. do...while loop
  2. While loop
  3. For loop
  4. Nested for loop

Jumping statement in C:

Jump statement are used to transfer control from one point to another point in the program. It allows to exit loop, start the next iteration of a loop and explicitly transfer program control to a specified location in you program.

Type of jumping statement:

  1. Break statement
  2. goto statement
  3. Continue statement














Protec Computer Academy (An ISO 9001:2015 Certified Institute, Powered by E-Max Education, Branch Code EMAX/EK-80503, Registered by government of India.) is a best IT training center in Siwan with 100% Job placement assistance. Where you can learn Programming, WebDesigning, Hardware|Networking, Blogging, WordPress, Digitial marketing, English Speaking, And many more...| All certificates are valid in Government Jobs as well as in Private Companies. *** At Tara Market, Beside Vishal Mega Mart - Siwan*** +966532621401, Email- ahmad.irshad781@gmail.com *** Follow us on | | @welcome2protec

Help others by sharing this page.

Ahmad Irshad

Author & Editor

I love blogging, teaching, learning computer science and sharing it to others. I've written and develped this site so that students may learn computer science related tutorials eaisly. MCA / MCITP

0 Comments:

Post a Comment

Please don't enter any spam link in the comment box.


Protec Computer Academy (An ISO 9001:2015 Certified Institute, Powered by E-Max Education, Branch Code EMAX/EK-80503, Registered by government of India.) is a best IT training center in Siwan with 100% Job placement assistance. Where you can learn Programming, WebDesigning, Hardware|Networking, Blogging, WordPress, Digitial marketing, English Speaking, And many more...| All certificates are valid in Government Jobs as well as in Private Companies. *** At Tara Market, Beside Vishal Mega Mart - Siwan*** +966532621401, Email- ahmad.irshad781@gmail.com *** Follow us on | | @welcome2protec
Protec Protec Protec Protec Protec Protec Protec Protec Protec Protec Protec Protec Protec Protec Protec Protec
Contact Us