“Hello, World!” Program in C

Exercise:

Write a C Program to print “Hello, World!”.

Click Here to View the Solution!
#include <stdio.h>
int main() {
    //printf() displays the string inside quotation marks enclosed by brackets
    printf("Hello, World!");
    return 0;
} 
Click Here to View the Output!
Hello, World! 
Click Here to View the Explanation!
  • This program is used to print the output on the screen.
  • A stdio.h file is included in a preprocessor command #include.
  • The command allows the program to utilize all the functions of stdio.h which include the scanf() and printf() functions that are used for accepting an input and printing an output.
  • If any of these functions are used in a program without using the #include command, the compilation of the program will not occur.
  • The main() method initiates the execution of the program.
  • The printf() function is used to print the message “Hello, World!” on the screen.
  • The program exits using the return 0 statement at the end of the program.

%d bloggers like this: