[ 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 | PHP | Perl | Python | Ruby | Scheme ]

C:
pasted 6 hours ago:
1
2
3
4
5
6
7
8
9
#include <stdio.h>

int main()
{
   /* Day la chuong trinh C dau tien */
   printf("Hello, World! \n");
   
   return 0;
}
view (9 lines, 1 line of output)
pasted 10 hours ago:
1
2
3
4
5
6
#include <stdio.h>

int main(void) {
  printf("Hello World\n");
  return 0;
}
view (6 lines, 1 line of output)


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

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


D:
pasted on Jun 10:
1
2
3
4
void main()
{
    writef("Hello, World!");
}
view (6 lines, 1 line of output)
pasted on Jun 10:
1
2
3
4
5
6
import std.stdio;

void main()
{
    writef("Hello, World!");
}
view (6 lines, 1 line of output)


Haskell:
pasted on Jul 12:
1
2
3
4
main = putStrLn "Hello World"

main2 = do putStr "Hello "
           putStrLn "World2"
view (4 lines, 1 line of output)
pasted on Jul 12:
1
2
3
4
main = putStrLn "Hello World"

main2 = do putStr "Hello "
           putStrLn "World2"
view (4 lines, 1 line of output)


Lua:
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)


PHP:
pasted 10 hours ago:
1
2
3
<?php
echo "Hello, World!";
?>
view (3 lines, 1 line of output)
pasted on Jul 13:
1
2
3
<?php
echo "Hello world";
?>
view (3 lines, 1 line of output)


Perl:
pasted on Jul 11:
1
2
3
#!/usr/bin/perl

print "hello world";
view (3 lines, 1 line of output)
pasted on Jul 4:
1
print "hello World"
view (1 line, 1 line of output)


Python:
pasted 4 hours ago:
1
2
print("Hello world")
x=1
view (2 lines, 1 line of output)
pasted 4 hours ago:
1
print("Hello world")
view (1 line, 1 line of output)


Ruby:
pasted on Jul 11:
1
print 'Hello World!'
view (1 line, 1 line of output)
pasted on Jul 11:
1
puts 'hello, world'
view (1 line, 1 line of output)


Scheme:
pasted on Jul 13:
1
(display "Hello, World!")
view (1 line, 1 line of output)
pasted on Jul 11:
1
(display "Hello, World!")
view (1 line, 1 line of output)