'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:
C:
- Java
- C
- C++
- C#
- Python
- SQL
- 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
Post a Comment