[ 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
7
8
9
// Online C compiler to run C program online
#include <stdio.h>

int main() {
    // Write C code here
    printf("Hello world");
    
    return 0;
}
view (9 lines, 1 line of output)
pasted 1 hour ago:
1
2
3
4
5
6
7
8
9
// Online C compiler to run C program online
#include <stdio.h>

int main() {
    // Write C code here
    printf("Hello world");
    
    return 0;
}
view (9 lines, 1 line of output)


C++:
pasted yesterday:
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 yesterday:
1
2
3
4
5
6
7
8
#include <iostream>
using namespace std;

int main()
{
cout << "hello, world!"; //  “hello,world!''
return 0;
}
view (8 lines, 1 line of output)


Haskell:
pasted on Sep 3:
1
2
main = 
    putStrLn "Hello, World!"
view (2 lines, 1 line of output, 3 comments)
pasted on Aug 30:
1
main = putStrLn "hello world"
view (1 line, 1 line of output, 3 comments)


Lua:
pasted yesterday:
1
print("Hello World")
view (1 line, 1 line of output)
pasted on Oct 26:
1
print("Hello, world!")
view (1 line, 1 line of output)


PHP:
pasted 4 hours ago:
1
2
3
4
5
<?php
echo 'hello world',"\n";
for ($i=0; $i < 100; $i++) { 
	echo $I,"\n";
}
view (5 lines, 101 lines of output)
pasted yesterday:
1
2
3
4
5
<?php

echo "Hello World!";

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


Perl:
pasted on Sep 20:
1
2
3
#Hello World
%c=qw(> $p++ < $p-- + D=(D+1)%256 - D=(D-1)%256 [ while(D){ ] } . print+chrD , D=ord(getc));
$/=$,;$_='++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.';s/./$c{$&};/g;s[D]'$b[$p]'g;eval
view (3 lines, 1 line of output, 3 comments)
pasted on Sep 3:
1
print "hello world!";
view (1 line, 1 line of output, 3 comments)


Python:
pasted 2 hours ago:
1
print("Hello World")   
view (1 line, 1 line of output)
pasted 3 hours ago:
1
print("hello world!")
view (1 line, 1 line of output)


Ruby:
pasted on Oct 28:
1
print "Hello World\n"
view (1 line, 1 line of output)
pasted on Oct 22:
1
2
3
4
5
# puts "Hello World"
test=1
if test == 1
    puts "Hello World"
end
view (5 lines, 1 line of output)


Scheme:
pasted on Oct 18:
1
(display "Hello, World!")
view (1 line, 1 line of output)
pasted on Oct 18:
1
(display "Hello, World!")
view (1 line, 1 line of output)