How to Understand Repetition in C Language
Loop Control Instructions: The programs
that we have developed so far used either a sequential or a decision control
instructions. In this article, we learn about loops, types of loops and
structure of loops.
So, Loops is…..
In programming, we frequently need to
perform an action over and over, often with variations in the details each
time.
The versatility of a 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 satisfied. This repetitive operation is done through a
loop control instruction
There is three-way to repeat a part of a program. They are:
1. Using
a while statement.
2. Using
for statement.
3. Using do-while statement.

Structure of loops:
1. While
loop:

2. For
loop:

3. Do-while
loop:

Some important point for creating loop control instructions:
·
I++ increments value by
1.
·
I- -decrement value of
1.
·
If j=++I; first
increment I, then assigned the increment value to j.
·
If j=- -I; first assign the current value of I to j, then increments j.
Comments
Post a Comment