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

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

int main()
{
    printf("Hello, World!\n");

    return 0;
}
view (8 lines, 1 line of output)
pasted 4 hours ago:
1
2
3
4
5
6
7
8
#include<stdio.h>

int main()
{
wchar_t w = "Hello World";
printf("%s",w);
return 0;
}
view (8 lines, 1 line of output)


C++:
pasted 9 minutes ago:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>

using namespace std;

int main()
{
   cout << "Hello World" << endl; 
  int i,a; 
for(i=1;i<=5;i++) 
{ 
for(a=1;a>i+1;a++)
{ 
cout<< a; 
} 
cout<< "\n" ; 
}  
   return 0;
}
view (19 lines, 6 lines of output)
pasted 4 hours ago:
1
2
3
4
5
6
7
8
#include<iostream>
using namespace std;

int main()
{
 cout<<"Hello world!"<<endl;
 return 0;
}
view (8 lines, 1 line of output)


D:
pasted on Jan 10:
1
2
3
4
5
int main()
{
printf("hello world!");
return 0;
}
view (5 lines, 1 line of output)
pasted on Nov 29:
1
2
3
4
5
int main()
{
printf("hello world!");
return 0;
}
view (6 lines, 1 line of output)


Haskell:
pasted on Feb 9:
1
main = putStrLn "hello world"
view (1 line, 1 line of output)
pasted on Feb 9:
1
main = putStrLn "hello world"
view (1 line, 1 line of output)


Lua:
pasted 4 hours ago:
1
print("Hello, world!")
view (1 line, 1 line of output)
pasted on Feb 10:
1
print("Hello World")
view (1 line, 1 line of output)


OCaml:
pasted on Nov 9:
1
print_string "Hello world!\n";;
view (1 line, 1 line of output)
pasted on Nov 5:
1
print_string "hello, world"
view (1 line, 1 line of output)


PHP:
pasted on Feb 10:
1
2
3
4
5
<?php

echo "hello world";

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


Perl:
pasted on Feb 8:
1
2
#!/usr/bin/perl 
print "Hello, World!\n"; 
view (2 lines, 1 line of output)
pasted on Feb 8:
1
2
#!/usr/bin/perl 
print "Hello, World!\n"; 
view (2 lines, 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 5 hours ago:
1
puts "hello world"
view (1 line, 1 line of output)
pasted 6 hours ago:
1
puts "hello world"
view (1 line, 1 line of output)


Scheme:
pasted on Jan 13:
1
(display "Hello world!")
view (1 line, 1 line of output)
pasted on Dec 29:
1
(display "Hello, World!")
view (1 line, 1 line of output)