Write a Program to Display a Message on the Screen

Posted in

Write a Program to Display a Message on the Screen

Vinay Khatri
Last updated on November 8, 2022

    Printing Hello World! on the screen is probably the first program for most programmers. It is a basic form of code that demonstrates how programming works.

    In this article, we will write a program to display a message on the screen. The message we will print will be Hello World! However, you can print something else, like HELLO PROGRAMMING, if you like.

    Problem Statement

    The program to display a message on the screen is simple. We need to write programs in C, C++ , and Python that print a HELLO WORLD! message on the console window. All we need to do is use the console print statement in all three programming languages.

    1. C Program to Display a Message on the Screen

    #include <stdio.h>
    
    int main()
    {	
    	//print the message	
    	printf("\n\n\n\n\n\n\n\n\t\t ******************  HELLO WORLD! ********************");
        return 0;
    }

    Output

    ******************  HELLO WORLD! ********************

    2. C++ Program to Display a Message on the Screen

    #include<iostream.h>
    #include< conio.h>
    
    void main()
    {
    clrscr();
    cout<<"\n\n\n\n\n\n\n\n\t\t\
    ******************  HELLO WORLD! ********************";
    getch();
    }

    Output

    ******************  HELLO WORLD! ********************

    3. Python Program to Display a Message on the Screen

    print("'\n\n\n\n\t\t\t**********************   HELLO WORLD!   ***********************")

    Output

    **********************   HELLO WORLD!   ***********************

    Conclusion

    The above programs are simple. Printing Hello World is a complete beginner-level program that you often encounter while writing your first program with any programming language . All we have done in the above program is print a sequence of characters with some escape characters. The \n represents the new line, and the \t escape character represents the tab (4 white spaces).

    People are also reading:

    Leave a Comment on this Post

    0 Comments