[ 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 yesterday:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/******************************************************************************

Welcome to GDB Online.
  GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby, 
  C#, OCaml, VB, Perl, Swift, Prolog, Javascript, Pascal, COBOL, HTML, CSS, JS
  Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <stdio.h>

int main()
{
    printf("Hello World");

    return 0;
}
view (16 lines, 1 line of output)
pasted on May 6:
1
2
3
4
5
#include<stdio.h>
void main()
{
    printf("Hello, World!");
}
view (5 lines, 1 line of output)


C++:
pasted yesterday:
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 May 6:
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)


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 10 hours ago:
1
print("Hello World")
view (1 line, 1 line of output)
pasted on May 6:
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)