HELLO WORLD Program in different languages

HELLO WORLD Program in different languages Nov. 28, 2020

Hello World Program

Overview

Hello World program is one of the first program for every developer in any language. In this post, I have compared this program in several languages.


C Language

#include<stdio.h>
int main(){
       printf("Hello World!");
}

C provides a function printf() to print the string which is included by a header file stdio.h .


C++ Language

#include<iostream.h>
int main(){
     cout<<"Hello World!";
}

C++ provides an object of output stream named cout to print the output which is included by a header file iostream.h .


Java Language

class Main{
       public static void main(String[] args){
                System.out.println("Hello World!");
       }
}

Java provides the functions print() and println() to print a string on the console which is inside the System class.


Python Language

print("Hello World!")

Python provides a function print to print on the console.


JavaScript Language

console.log("Hello World");

JavaScript provides console.log() function to print the data.


PHP Language

echo "Hello World!";
//or
print "Hello World!";

echo or print statement are used to print a string. echo is faster than print statement.


Don't forget to rate and review. Your reviews are the key point of our improvement.


Rate this post

Comments