[ create a new paste ] login | about

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

C:
pasted 1 hour ago:
1
2
3
4
5
6
#include<stdio.h>

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

int main()
{
  /* 我的第一个 C 程序 */
  printf("Hello, World! \n");
  
  return 0;
}
view (9 lines, 1 line of output)


C++:
pasted yesterday:
1
2
3
4
5
int main()
{
   cout << "Hello World"; // 输出 Hello World
   return 0;
}
view (5 lines, 1 line of output)
pasted on Jun 4:
1
2
3
4
5
#include <iostream>
int main()
{
    cout << "Hello, world";
}
view (5 lines, 1 line of output)


Haskell:
pasted on Jun 4:
1
2
main :: IO ()
main = putStrLn "Hello, world!"
view (2 lines, 1 line of output)
pasted on Apr 13:
1
main = putStrLn "Hello, World!"
view (1 line, 1 line of output)


Lua:
pasted on Jun 4:
1
print("Hello, World!")
view (1 line, 1 line of output)
pasted on Apr 21:
1
print("Hello world")
view (1 line, 1 line of output)


OCaml:
pasted on Mar 28:
1
print_string "Hello world!\n"
view (1 line, 1 line of output)
pasted on Mar 28:
1
print_string "Hello world!\n";
view (1 line, 1 line of output)


PHP:
pasted yesterday:
1
2
3
4
5
<?php

echo "Hello World!";

?>
view (5 lines, 1 line of output)
pasted on Jun 4:
1
2
3
4
<?php
echo "Hello World";

?>
view (4 lines, 1 line of output)


Perl:
pasted on Apr 22:
1
print "Hello World\n";
view (1 line, 1 line of output)
pasted on Apr 12:
1
2
3
#!/usr/bin/perl

printf("Hello world\n");
view (3 lines, 1 line of output)


Python:
pasted 5 hours ago:
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 Jun 4:
1
puts "hello world";
view (1 line, 1 line of output)
pasted on Apr 23:
1
puts("Hello world!")
view (1 line, 1 line of output)


Scheme:
pasted on Apr 14:
1
(display "Hello, World")
view (1 line, 1 line of output)
pasted on Apr 11:
1
(display "Hello, World")
view (1 line, 1 line of output)