'Hello, World!' program in 7 different languages

Generally 'Hello World!' program is the first ever program that you'd do in any language. It is a rite of passage into more complex programs in any language. So here's a quick look at how to write 'Hello, World!' program in 5 major languages which are:

  1. Java
  2. C
  3. C++
  4. C#
  5. Python
  6. SQL
  7. Ruby
 Java:
public class HelloWorld {

    public static void main(String[] args) {
        // Prints "Hello, World" to the terminal window.
        System.out.println("Hello, World!");
    }

}

C:
#include "stdio.h"

int main(void)
{
    printf("Hello, World!");
    return 0;
}

C++:
#include "iostream"
using namespace std;

int main()
{
    cout << "Hello, World!";
    return 0;
}

C#:
public class Hello
{
   public static void Main()
   {
      System.Console.WriteLine("Hello, World!");
   }
}

Python:
print("Hello, world!")

SQL:
DECLARE
   message  varchar2(20):= 'Hello, World!';
BEGIN
   dbms_output.put_line(message);
END;
/

Ruby:
puts 'Hello, World!'


Comments

Popular posts from this blog

Beginner's guide to Solving the N-Queens problem using backtracking method

PvP Chain reaction game using Python

Guide to Solving Maximal Subarray Problem using Kadane's Algorithm