C Program to Print Hello World

How to write a sample C program to Print Hello World?. It is the basic and traditional program to start any programming language. This sample program also helps you to understand the basic programming structure of C Programming.

C Program to Print Hello World

This sample program will print the hello world.

#include <stdio.h>
int main()
{
  printf("\n Hello World");
  return 0;
}
 Hello World

Within this Sample Program, first, we included the stdio.h, which is a standard input-output header file. This file allows you to use standard functions such as printf and scanf.

#include <stdio.h>

The following C language printf statement will print the message.

printf("\n Hello World");

In this program, we are using the For Loop to print the same statement multiple times. You can also use While Loop, or Do While to get the same result.

#include <stdio.h>
int main()
{
	int i;
	for (i = 1; i <= 5; i++)
	{
		printf("\n Hello World");
	}
	return 0;
}
Simple C Program to Print Hello World 2

In this C program, we are using the Functions concept to print the Hello World message.

#include <stdio.h>
void PrintHelloWorld();
int main()
{
	PrintHelloWorld();
	return 0;
}
void PrintHelloWorld()
{
	printf("\n Hello World");
}
 
Hello World

About Suresh

Suresh is the founder of TutorialGateway and a freelance software developer. He specialized in Designing and Developing Windows and Web applications. The experience he gained in Programming and BI integration, and reporting tools translates into this blog. You can find him on Facebook or Twitter.

Comments are closed.