[ create a new paste ] login | about

Listed below are example programs that print "hello world", written in the following languages:
[ C | C++ | D | Haskell | Lua | OCaml | PHP | Perl | Python | Ruby | Scheme | Tcl ]

C:
pasted 1 hour ago:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <stdio.h>


int main(){

int x;

printf("hello world\n");
scanf("%d",&x);


return 0;


}
view (15 lines, 1 line of output)
pasted 2 hours ago:
1
2
3
4
5
6
7
8
#include <stdio.h>

int main()
{
printf ("hello world");

return 0;
}
view (8 lines, 1 line of output)


C++:
pasted 24 minutes ago:
1
2
3
4
5
6
7
#include <iostream>
 
int main()
{
  std::cout << "Hello World!" << std::endl;
  return 0;
}
view (7 lines, 1 line of output)
pasted 58 minutes ago:
1
2
3
4
5
6
7
8
#include <iostream>
using namespace std;

int main()
{
    cout << "Hello World!" << endl;
    return 0;
}
view (8 lines, 1 line of output)


D:
pasted on Oct 17:
1
2
3
4
int main() {
    printf("Hello World");
    return 0;
}
view (4 lines, 1 line of output)
pasted on Oct 12:
1
2
3
4
int main() {
    printf("Hello World");
    return 0;
}
view (4 lines, 1 line of output)


Haskell:
pasted on Oct 21:
1
2
3
4
module Main where

main :: IO ()
main = putStrLn "Hello World"
view (4 lines, 1 line of output)
pasted on Oct 17:
1
main = putStrLn "Hello World"
view (1 line, 1 line of output)


Lua:
pasted yesterday:
1
print("hello world")
view (1 line, 1 line of output)
pasted on Oct 21:
1
2
3
4
function xyz()
    print("Hello, World!")
end
xyz()
view (4 lines, 1 line of output)


OCaml:
pasted on Oct 9:
1
print_string "Hello World!\n";;
view (1 line, 1 line of output)
pasted on Aug 8:
1
2
let x = "hello world";;
Printf.printf "%s" x;;
view (2 lines, 1 line of output)


PHP:
pasted 1 hour ago:
1
2
3
4
5
<?php

echo "hello world";

?>
view (5 lines, 1 line of output)
pasted 7 hours ago:
1
2
3
4
<?php

echo "HELLO WORLD";
?>
view (4 lines, 1 line of output)


Perl:
pasted yesterday:
1
2
3
4
5
print "Hello World!\n";
my $string = "RxNoiseGenerator = -1 dB";

print ($string=~/-?\d+(\.\d+)?/);
#print $string;
view (5 lines, 1 line of output)
pasted on Oct 21:
1
2
#!/usr/bin/perl
print "Hello World!\n";
view (3 lines, 1 line of output)


Python:
pasted 3 hours ago:
1
print("Hello World")
view (1 line, 1 line of output)
pasted 5 hours ago:
1
print "Hello World"
view (1 line, 1 line of output)


Ruby:
pasted on Oct 19:
1
puts "Hello, world!"
view (1 line, 1 line of output)
pasted on Oct 17:
1
puts "hello world"
view (1 line, 1 line of output)


Scheme:
pasted on Oct 21:
1
(display "Hello World!")
view (1 line, 1 line of output)
pasted on Oct 14:
1
(display "Hello, World!")
view (1 line, 1 line of output)


Tcl:
pasted on Oct 6:
1
puts -nonewline "Hello world!"
view (1 line, 1 line of output)
pasted on Jul 31:
1
puts -nonewline "Hello world!"
view (1 line, 1 line of output)