Login
Login

How To Print Hello World In C Programming In 2 Steps

Spread the love

Last Updated on July 16, 2021 by Rohitash Kumawat

How To Print Hello World In C Programming In 2 Steps

‘Welcome in Study Learner

Today i will teach you how to write basic program (Hello World) in c

Step 1

Here we will write C programs to display hello world on the screen. In this program we displaying the message using printf function.

Syntax:

#include<stdio.h> //include header file

int main() //main function
{ //body open
body of this program
} //body close

#include<stdio.h>
int main()
{
    //printf() display the string inside quotation
    printf("Hello World");
    return 0;
}

Output:-

Output

How will the program work?

  1. include :- The #include is a preprocessor command that tells the compiler to include the contents of stdio.h(standred input and output) file in program.
  2. int main :- Here main() is the function name and int is return type of this function.Every C program must have this function because the execution of program begins with the main() function.
  3. printf() :- printf() is a library function to send formatted output to the screen.
  4. printf(“Welcome in Studylearner”); :-printf() function display the content within double quotes.
  5. retrun 0; :- return 0 means successful execution of main() function.

More program:

1.Print In Multiple Line.
#include<stdio.h>
int main()
{
	printf("Welcome In Study Learner\n");
        // '\n' use for change line
	printf("Learn Code With Study Learner");
        return 0;
}

Output:-

Output

2.Print name, data of birth and mobile number.
#include<stdio.h>
int main()
{
	printf("Name:	      John\n");
	printf("DOB:          April 4, 1997\n");
	printf("Mobile:       9988776655");
        return 0;
}

Output:-

Output

3. Print Hello World Using Function.
#include<stdio.h>
void printname(void)
//printname is a function to print 'Hello World'
{
	printf("Hello World");
}
int main()
{
	printname();  //function call in main function
        return 0;
}

Output:-

Output

Join Study Learner👇👇
▰▱▰▱▰▱▰▱▰▱▰▱▰▱▰
🌏●☞ Jᴏɪɴ➠ यहाँ पर क्लिक करें 🌏https://www.youtube.com/studylearner
▰▱▰▱▰▱▰▱▰▱▰▱▰▱▰
❤❤Share & Support❤❤
🖤▰▱ ☆★ ▱▰ ☆★ ▰▱ ☆★🖤

अगर आपका कोई सवाल हो तो आप हमें कमेंट बॉक्स में अपने सवाल पूछ सकते हैं।
इसके अलावा शिक्षा से जुड़ी लेटेस्ट जानकारियों के लिए हमें फॉलो करें।


Spread the love

1 thought on “How To Print Hello World In C Programming In 2 Steps”

Leave a Comment


error: Content is protected !!