Skip to content

Instantly share code, notes, and snippets.

@easoncxz
Last active August 29, 2015 14:04
Show Gist options
  • Save easoncxz/87e26fce69b32f39c8b0 to your computer and use it in GitHub Desktop.
Save easoncxz/87e26fce69b32f39c8b0 to your computer and use it in GitHub Desktop.
Hello World in a few different languages
#inlcude <stdio.h>
void main() {
printf("hello world\n");
}
#include <iostream>
using namespace std;
int main() {
cout << "hello world\n";
return 0;
}
<?php
echo "hello world\n";
?>
print("hello world")
public class SomeClass {
public static void main(String[] args) {
System.out.println("hello world");
}
}
# The lines below starting with the dollar sign ($) denote commands you type in (at the terminal).
# The lines without a dollar sign denote program output.
# Some blank lines are added between languages, for readability.
$ python python.py
hello world
$ javac SomeClass.java
$ java SomeClass
hello world
$ gcc c.c -o c
$ ./c
hello world
$ g++ cpp.cpp -o cpp
$ ./cpp
hello world
$ php php.php
hello world
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment