Here we are going to write a Hello World program in C using function. Earlier we have done this program normally that is just c program to print hello world. This time we will do this using function.
First we will create a function named printhelloworld() of void return type and it won't take any parameter. Just print the hello world.
Then in main function, we will call the printhelloworld() function that's it.
Now lets code it. But before going down I will suggest you to first try it on your own and then see the solution.
Write a Hello World program in C using function
#include <stdio.h>
void printhelloworld(){
printf("Hello, World!");
}
int main(){
printhelloworld();
return 0;
}
Output
Hello, World!• Program to print "Hello, World!"
• Program to find area of circle
• Program to swap two numbers without using third variable
• Program to find sum of two numbers
• Program to find square root of numbers
• Program to calculate Simple Interest
• Program to convert temperature from Celsius to Fahrenheit
• Program to convert character to its ASCII Value
• Program to perform arithmetic operations
• Program to find sum of digits of a number
• Program to find LCM & GCD of two numbers
• Program to find GCD of two numbers
Post a Comment
If you have any doubts, please let me know