The loop Control Structure in C

The programs that we have learned/developed in this tutorial so far used either a sequential or a decision control instruction. In the first one, the calculations were carried out in a fixed order, while in the second, an appropriate set of instructions were executed depending upon the outcome of the condition being tested (or a logical decision being taken).

These programs were of limited nature, because when executed, they always performed the same series of actions, in the same way, exactly once. Almost always, if something is worth doing, it’s worth doing more than once. You can probably think of several examples of this from real life, such as eating a good dinner or going for a movie. Programming is the same;

we frequently need to perform an action over and over, often with variations in the details each time. The mechanism, which meets this need, is the ‘loop’, and loops are the title of this blog post.


The versatility of the computer lies in its ability to perform a set of instructions repeatedly. This involves repeating some portion of the program either a specified number of times or until a particular condition is being satisfied.This repetitive operation is done through a loop control instruction.

There are three methods by way of which we can repeat a part of a program.  They are:

  • Using a for statement
  • Using a while statement
  • Using a do-while statement




Related Posts

  • 63
    Like most languages, C uses the keyword if to implement the decision control instruction. The general form of if statement looks like this: if ( this condition is true )       execute this statement ; The keyword if tells the compiler that what follows is a decision control…
    Tags: statement, condition, number, program, executed, control, decision, instruction, learn, programming
  • 62
    Decision !!! we all need to alter our actions in the face of changing circumstances. If the weather is fine, then I will go for a stroll. If the highway is busy I would take a diversion. If the pitch takes spin, we would win the match. If she says…
    Tags: executed, statement, instructions, decision, control, structure, set, program, programs, actions
  • 60
    It may so happen that in a program we want more than one statement to be executed if the expression following if is satisfied. If such multiple statements are to be executed then they must be placed within a pair of braces as illustrated in the below example. Example: The current year…
    Tags: executed, statement, program, condition, number, control, decision, learn, structure, programming
  • 53
    Uses of Odd Loop In real life programming one comes across a situation when it is not known beforehand how many times the statements in the loop are to be executed. This situation can be programmed as shown below: /* Execution of a loop an unknown number of times */…
    Tags: number, loop, learn, programming, tutorial
  • 50
    Problem Statement: If a four-digit number is input through the keyboard, write a program to obtain the sum of the first and last digit of this number. Solution: /* Sum of 1st and last digit of a four digit number */ #include<stdio.h> #include<conio.h> main() { int n,a,sum=0; clrscr(); printf("\Enter a…
    Tags: number, program, learn, tutorial, programming, basic

Satya Prakash

VOIP Expert: More than 8 years of experience in Asterisk Development and Call Center operation Management. Unique Combination of Skill Set as IT, Analytics and operation management.

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: