Q:

Write a C Program to Print Hello World Program

0

Write a C Program to Print Hello World Program. In this program ,we just print the “Hello World!” line on the computer screen.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

This is the basic Example for the beginners of C Programming Language….Let’s have a look at the program below :

 
 

A C program basically consists of the following parts −


  • Preprocessor Commands
  • Functions
  • Variables
  • Statements & Expressions
  • Comments

 


Let us look at a simple code that would print the words “Hello World” −

#include<stdio.h>

int main() {

printf("Hello, World! \n");

return 0;
}

Let us take a look at the various parts of the above program −


  • The first line of the program #include is a preprocessor command, which tells a C compiler to include stdio.h file before going to actual compilation.

  • The next line int main() is the main function where the program execution begins.

  • The next line /*…*/ will be ignored by the compiler and it has been put to add additional comments in the program. So such lines are called comments in the program.

  • The next line printf(…) is another function available in C which causes the message “Hello, World!” to be displayed on the screen.

  • The next line return 0; terminates the main() function and returns the value 0.


Compile and Execute C Program : :

Hello, World!


Above is the source code for C Program to Print Hello World Program which is successfully compiled and run on Windows System.The Output of the program is shown above .

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C Basic Solved Programs – C Programming

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Write a C Program to calculate simple interest... >>