Code Your First C Program!

Exercise:

Write a C program that displays “Hello, C Programming World!” onto the screen.

Click Here to View the Solution!
#include <stdio.h>

int main() {
   // printf() function displays formatted output onto the screen. 
   printf("Hello, C Programming World!");
  
   return 0; // Program is terminated with this statement.
} // end of the main() function
Click Here to See the Output!
Hello, C Programming World!
Click Here to View the Explanation!
  • In the first line, the #include is a preprocessor command, which lets the compiler know to include contents of the of the standard input and output file <stdio.h> in our “Hello, C Programming World!” program.
  • The <stdio.h> file contains many functions such as the formatted print function printf() that is used to display the output “Hello, C Programming World!”. In order for this program to compile you must include the line #include <stdio.h>.
  • The execution of every C program starts from the function main().
  • Lastly the statement return 0; is used to end the execution of the program.
%d bloggers like this: