[ 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 1 hour ago:
1
2
3
4
5
6
#include <stdio.h>
int main()
{
	printf("hello world");
	return 0;
}
view (6 lines, 1 line of output)
pasted 5 hours ago:
1
2
3
4
5
6
7
#include <stdio.h>

void main( void )
{
  int ar[10] = {0};
  printf("Hello world");
}
view (7 lines, 1 line of output)


C++:
pasted 1 hour ago:
1
2
3
4
5
6
//hi earth
#include <iostream>
int main () 
{
std::cout << "Hello World";
} 
view (6 lines, 1 line of output)
pasted 8 hours ago:
1
2
3
4
5
6
7
#include <iostream>

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


Haskell:
pasted on Apr 3:
1
2
3
main :: IO ()
main = do
  putStrLn "Hello World!"
view (3 lines, 1 line of output)
pasted on Mar 3:
1
2
main :: IO ()
main = putStrLn "hello world"
view (2 lines, 1 line of output)


Lua:
pasted on Apr 16:
1
print ("Hello World");
view (1 line, 1 line of output)
pasted on Apr 16:
1
print ("Hello World")
view (1 line, 1 line of output)


PHP:
pasted yesterday:
1
2
3
4
5
6
7
<?php
function writeMsg() {
    echo "Hello world!";
}

writeMsg(); // call the function
?>
view (7 lines, 1 line of output)
pasted on Apr 19:
1
2
3
<?php

echo 'hello world';
view (3 lines, 1 line of output)


Perl:
pasted on Apr 12:
1
print "Hello, World!\n";
view (1 line, 1 line of output)
pasted on Apr 7:
1
print "Hello world";
view (1 line, 1 line of output)


Python:
pasted 5 minutes ago:
1
print('hello world')
view (1 line, 1 line of output)
pasted 43 minutes ago:
1
print 'hello world'
view (1 line, 1 line of output)


Ruby:
pasted yesterday:
1
printf("Hello world")
view (1 line, 1 line of output)
pasted yesterday:
1
printf("Hello world")
view (1 line, 1 line of output)


Scheme:
pasted on Apr 13:
1
(display "hello world")
view (1 line, 1 line of output)
pasted on Apr 8:
1
(display "Hello, World!")
view (1 line, 1 line of output)