[ 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
int main() {
  printf("Hello World!");
  int a = 0;
  printf(a);
  return 0;
}
view (6 lines, 1 line of output)
pasted 1 hour ago:
1
2
3
4
5
6
int main() {
  printf("Hello World!");
  int a = 0;
  printf(a);
  return 0;
}
view (6 lines, 1 line of output)


C++:
pasted 6 hours ago:
1
2
3
4
5
6
7
8
#include<iostream>
using namespace std;

int main()
{
    cout<< "Hello World";
    return 0;
}
view (8 lines, 1 line of output)
pasted 10 hours ago:
1
2
3
4
5
6
7
8
9
#include <iostream>

using namespace std;

int main(){
    
    cout << "hello world" << endl;

}
view (9 lines, 1 line of output)


Haskell:
pasted on Jul 20:
1
2
main :: IO()
main = putStrLn "Hello World!"
view (2 lines, 1 line of output)
pasted on May 5:
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 Jul 18:
1
print ("Hello World")
view (1 line, 1 line of output)


OCaml:
pasted on Apr 6:
1
print_string "Hello World"
view (1 line, 1 line of output)


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


Perl:
pasted on Jul 26:
1
print("Hello, world!")
view (2 lines, 1 line of output)
pasted on May 20:
1
print("Hello, world!")
view (1 line, 1 line of output)


Python:
pasted 3 hours ago:
1
print('Hello World')
view (1 line, 1 line of output)
Vaishnavi_537 - pasted 7 hours ago:
1
print("Hello World")
view (1 line, 1 line of output)


Ruby:
pasted on Jul 19:
1
puts("hello world")
view (1 line, 1 line of output)
pasted on Jul 19:
1
puts 'Hello world'
view (1 line, 1 line of output)


Scheme:
pasted on Aug 13:
1
(display "hello world")
view (1 line, 1 line of output)
pasted on Jul 21:
1
(display "hello world")
view (1 line, 1 line of output)