Looping in C

Let’s assume a situation where we need to print “Good Moring” 10 times.

What will be the solution?

Is it printing Good Morning 10 times using printf? like below,


Example

printf("Good Morning\n");
printf("Good Morning\n");
printf("Good Morning\n");
printf("Good Morning\n");
printf("Good Morning\n");
printf("Good Morning\n");
printf("Good Morning\n");
printf("Good Morning\n");
printf("Good Morning\n");
printf("Good Morning\n");

No. It’s not a good programming practice.

C language provides looping statements to handle these kinds of situation.


Looping statements allows us to repeat statements execution till the given condition becomes true.


Topics You Might Like