Online visitors

People learning around the world

Online

—

Visitors exploring W3Schools

Online visitors by country Circles show approximate country locations. The country list provides the visitor counts.

Circles represent countries, not exact visitor locations.

Country

Online

Loading country activity…

    C Hello World Program to Print String Multiple Times

    C Programming Examples


    In this tutorial, a basic C program is demonstrated to print Hello World several times as the output on the screen. The primary aim of this C program is to explain to beginners how the printf() function works inside the loop.

    Example C Program:
    //C program to print Hello World several times as output on the screen.
    #include<stdio.h>
    
    void main ()
    {
      int num, i;
      printf ("Enter the number of times the string should be printed: ");
      scanf ("%d", &num);
      for (i = 1; i <= num; i++)
        {
          printf ("Hello World\n");
        }
    }

    Program Output:

    Enter the number of times the string should be printed: 4
    Hello World
    Hello World
    Hello World
    Hello World
    


    Found This Page Useful? Share It!
    Get the Latest Tutorials and Updates
    Join us on Telegram

    Notifications

    Updates are enabled for this browser.

    Receive new tutorials, articles and learning resources. You can turn updates off anytime.