Sunday, November 13, 2016

7 programming languages to say "Hello World"

Java

public class Hello
{
  public static void main(String args[])
  {
    String s = "Hello world!";
    System.out.println(s);
  }
}

C++

#include <string>
#include <iostream>
using namespace std;
int main()
{
  string s("Hello world!");  // use library string
  char s1[]="Hello world!";  // use base library
  cout<<s<<endl;
  return 0;
}

Python

s = "Hello world!"
print s  # python 2.x
print(s) # python 3.x

HTML

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
    </head>
    <body>
        "Hello world!"
    </body>
</html>

PHP

<?php  
  $s= "Hello wolrd!"; 
  echo $s;
  ?>

JavaScript

var s=“Hello World!”;
console.log(s);

swift

var s="Hello world" // inferred typing
var s1: Character = "Hello world" //explicit typing
print(s)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.