UnConditional And Loop Control Statements of C Language Part-2

Engg.... | 04:14 | | | | Best Blogger Tips
do-while loop

  • C supports an unconditional control statement that is goto. 
  • goto is used to transfer control from one point to other in a C program.
  • Goto is a branching statement.
  • It requires a label. 
  • goto is a keyword.

The syntax of goto statement is:

 goto  END:  

Points to remember about goto statement:
  1. goto statement is used whenever necessary else should be avoid.
  2. goto statement create an infinite loop.
  3. Any number of goto statements used in C program.
  4. No two goto statements have the same label name.
NOTE: Lable can be placed either before or after the goto statement.

Three types of loop control structures are used in C language.
  1. While Loop
  2. Do-while Loop
  3. For Loop
While Loop:
This is used to execute a set of statements repeatedly as long as the condition is TRUE.The syntax of While Loop is:

Statement => simple or compound statement
while => keyword
Condition => results in TRUE or FALSE

Explanation:  If the logical condition is TRUE then the statement is repetedly executed. If the result is FALSE then control comes out of the loop and continues with the next executable statement.The value of variable involved in the logical condition will be changed during every pass of while loop. If the value does not changed then control does not come out of the loop and statements executed repeatedly that is infinite loop.

int a=0;
printf(" the value of a is=%d/n" , a);

Value of a=1
Value of a=2
Value of a=3
Value of a=4

Do-while Loop:
This is used to execute a set of statements repeatedly,untill the logical test results in FALSE.The syntax of Do-while Loop is:

  } while(condition); 

Explanation: If the logical condition is TRUE then the statement is repetedly executed. If the result is FALSE then control comes out of the do-while loop and continues with the next executable statement.

For Loop:
It is used when the programmer knows how many times a set of statements are to be executed. The syntax of for loop is:

 for ( exp1; exp2; exp3) 

Exp1 => assign the value to variable.
Exp2 => give condition to variable.
Exp3 => increment or decrement in the value of variable.
Statement => compound or simple statement
for => keyword

for  (i=8 ; i>4 ; i--)
printf("value of i=%d/n" , i);


Value of i=8
Value of i=7
Value of i=6
Value of i=5

Please Share it! :)
Do you like this Story?

Get Free Email Updates Daily!

Follow us!


  1. I believe that unarmed truth and unconditional love will have the final word in reality. This is why right, temporarily defeated, is stronger than evil triumphant. See the link below for more info.


  2. I used a lot of emoticons in my sms and in my networking site. I find it cute and interesting. It portraits on my emotions.


  3. Love it! Very interesting topics, I hope the incoming comments and suggestion are equally positive. Thank you for sharing this information that is actually helpful.


  4. I really enjoyed reading your article. I found this as an informative and interesting post, so i think it is very useful and knowledgeable. I would like to thank you for the effort you have made in writing this article.


  5. Excellent…Amazing…. I’m satisfied to find so many helpful information here within the put up,for latest php jobs in hyderabad. we want work out extra strategies in this regard, thanks for sharing.