C program to print hello world 10 times

In this program we will print hello world 10 times using while loop. There are different approach to print this message and we will see one of them using while loop.

Pre-requisites:

Input output functions, while loop

Approach:

  • First declare counter variable i and initialize it to 0.

  • Use while loop with condition i is less than to 10 and this will make sure loop iterates 10 times.

  • Inside body of while loop use printf() function to print the message on screen and specify the text inside double quotes in printf() function.

  • Increment the counter variable i by 1 before while loop body closes.

Program:

Output:


Leave a Reply

%d bloggers like this: