[ 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() displays the string inside quotation
   printf("Hello, World!");
   return 0;
}
view (6 lines, 1 line of output)
pasted 1 hour ago:
1
2
3
4
5
6
#include <stdio.h>
int main() {
   // printf() displays the string inside quotation
   printf("Hello, World!");
   return 0;
}
view (6 lines, 1 line of output)


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

int main() {
    cout << "hello world" << endl;
    return 0;
}
view (7 lines, 1 line of output)
pasted on Apr 25:
1
2
3
4
5
#include <iostream>
using namespace std;

int main()
{cout<<"hello world"<<endl;}
view (5 lines, 1 line of output)


Haskell:
pasted on Mar 4:
1
2
3
import Control.Applicative

main = putStrLn "Hello, world!"
view (3 lines, 1 line of output)
pasted on Dec 30:
1
2
3
import Control.Applicative

main = putStrLn "Hello, world!"
view (3 lines, 1 line of output)


Lua:
pasted on Apr 27:
1
print('hello world')
view (1 line, 1 line of output)
pasted on Mar 23:
1
print("Hello world")
view (1 line, 1 line of output)


PHP:
pasted on Apr 17:
1
2
3
4
5
<?php
$metin = "<h1>Hello WorldÆØÅ!</h1>";
$yeni_metin=filter_var($metin,FILTER_SANITIZE_STRING,FILTER_FLAG_STRIP_HIGH);
echo $yeni_metin;
?>
view (5 lines, 1 line of output)
pasted on Apr 3:
1
2
3
<?php
echo "Hello World!";
?>
view (3 lines, 1 line of output)


Perl:
pasted on Apr 20:
1
2
3
use strict;
use warnings;
print "Hello World\n";
view (3 lines, 1 line of output)
pasted on Apr 20:
1
print "Hello World\n";
view (1 line, 1 line of output)


Python:
pasted yesterday:
1
print('Hello World')
view (1 line, 1 line of output)
pasted on May 3:
1
print("hello world")
view (1 line, 1 line of output)


Ruby:
pasted on May 3:
1
print('hello world')
view (1 line, 1 line of output)
pasted on Mar 13:
1
2
text = "Hello World"
puts text
view (2 lines, 1 line of output)


Scheme:
pasted on Nov 16:
1
(display "Hello, World")
view (1 line, 1 line of output, 284 comments)