[ create a new paste ] login | about

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

C:
pasted yesterday:
1
2
3
4
5
6
#include<stdio.h>
int main()
{
printf("Hello World!");
return 0;
}
view (6 lines, 1 line of output)
pasted yesterday:
1
2
3
4
5
#include <stdio.h>
int main (void) {
  printf("Hello world!");
return 0;
}
view (5 lines, 1 line of output)


C++:
pasted 3 hours ago:
1
2
3
4
5
6
#include <iostream>
 
int main() {
    std::cout << "Hello, world!\n";
    return 0;
}
view (6 lines, 1 line of output)
pasted 3 hours ago:
1
2
3
4
5
6
#include <iostream>
 
int main() {
    std::cout << "Hello, world!\n";
    return 0;
}
view (6 lines, 1 line of output)


Haskell:
pasted on Dec 3:
1
main = putStrLn "Hello World"
view (1 line, 1 line of output)
pasted on Dec 1:
1
main = putStrLn "Hello World"
view (1 line, 1 line of output)


Lua:
pasted on Jan 31:
1
2
3
string = 'teste'

print ("hello world")
view (3 lines, 1 line of output)
pasted on Jan 28:
1
2
3
string = 'teste'

print ("hello world")
view (3 lines, 1 line of output)


PHP:
pasted yesterday:
1
2
3
<?php
echo "Hello World";
?>
view (3 lines, 1 line of output)
pasted on Jan 30:
1
2
3
<?php
echo"Hello world";
?>
view (3 lines, 1 line of output)


Perl:
pasted on Jan 14:
1
print "hello world";
view (1 line, 1 line of output)
pasted on Jan 10:
1
print "hello, world\n"
view (1 line, 1 line of output)


Python:
pasted yesterday:
1
print "Hello World"
view (1 line, 1 line of output)
pasted yesterday:
1
print("HELLO WOrld")
view (1 line, 1 line of output)


Ruby:
pasted on Jan 9:
1
print "Hello World"
view (1 line, 1 line of output)
pasted on Jan 9:
1
print "Hello World"
view (1 line, 1 line of output)


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