Programming With C : Nested Loops and Jumping Statements- Lecture4

As we discussed in our last chapter

Loops, like if-else statements, can be nested, one within another.

While, the inner and outer loops need not be generated by the same type of control structure.

It is essential,  that one loop be completely embedded within the other  – there can be no overlap.

Therefore, Each loop must be controlled by different index.

Moreover, nested control structure can involve both loops and if-else statement.

Thus, a loop can be nested within an if-else statement, and an if-else statement can be nested within a loop.

Hence, the nested structure may be complex as necessary, as determined by the program logic.

Continue reading “Programming With C : Nested Loops and Jumping Statements- Lecture4”

Programming with C – “Control Statements – Loop”- Lecture 3

Suppose we want to display hello on output screen five times in five different lines.

We might think of writing either five printf statements or one printf statement consisting of constant “hello\n” five times.

What if we want to display hello 500 times?

Should we write 500 printf statement or equivalent ?

Obviously not.

It means that we need some programming facility to repeat certain works. Such facility in Programming Languages is available in the form Looping Statements.

Continue reading “Programming with C – “Control Statements – Loop”- Lecture 3″