Hello World program in different languages
In this blog, I am going to tell you how you can write a “hello world” program in different programming languages. We will see how to write a “hello world” program in languages like Assembly, C, C++, C#, Java, JavaScript, Kotlin, PHP, Ruby, Python, Dart, Typescript, Go, Rust, and many more.
1. C Language
The C language is a general-purpose programming language. It was created by Dennis Ritchie. It is used to create software like operating systems, compilers, etc.
Hello World program in C language
#include <stdio.h>; int main() { printf("Hello World"); return 0; }
2. C++ Language
The C++ programming language is an extension of the C programming language. It was created by Jarne Stroustrup. It can be used to develop high-performance applications.
Hello World program in C++ language
#include<iostream> using namespace std; int main() { cout<<"Hello World"; return 0; }
3. C# Language
Microsoft’s C# programming language is a general-purpose, object-oriented programming language that runs on the.NET framework. It is used to create web apps, desktop apps, games, etc.
Hello World program in C# language
using System; namespace HelloWorld { class Hello { static void Main(string[] args) { Console.WriteLine("Hello World"); } } }
4. Java Language
Java is a general-purpose, high-level, object-oriented programming language. A compiled Java code can run on all java supported platforms without recompiling. It is used to develop web apps, desktop apps, mobile apps, games, etc.
Hello World program in Java language
class HelloWorld { public static void main(String[] args) { System.out.println("Hello World"); } }
5. JavaScript Language
JavaScript is a lightweight, object-oriented scripting language which enables us to create dynamic web page content.
Hello World program in JavaScript language
# This program prints Hello, world! console.log("Hello World");
6. Kotlin Language
Kotlin is a general-purpose, cross-platform, statically typed, programming language. Kotlin is now the preferred language for Android app developers.
Hello World program in Kotlin language
fun main() { println("Hello World") }
7. PHP Language
PHP is a general-purpose scripting language used for web development. It was created by Rasmus Lerdorf in 1993 and released in 1995. PHP is used by almost 78% of all the websites on the internet.
Hello World program in PHP language
<?php echo "Hello World"; ?>
8. Ruby Language
Ruby is a general-purpose, object-oriented, dynamic, open-source programming language. It was created in 1993 by Yukihiro Matsumoto of Japan.
Hello World program in Ruby language
# This program prints Hello, world! puts "Hello World"
9. Python Language
Python is a high-level, interpreted programming language widely used for web development, scientific computing, data analysis, artificial intelligence, and a variety of other applications.
Hello World program in Python language
# This program prints Hello, world! print('Hello World')
10. Dart Language
Dart is a programming language used for web and mobile applications. It was created by Google and can be used to create server and desktop applications. It is an object-oriented language with C-style syntax.
Hello World program in Dart language
void main() { print('Hello World'); }
11. Typescript Language
Microsoft created and maintains TypeScript. It is a free and open-source programming language. TypeScript is a typed superset of JavaScript that compiles to plain JavaScript.
Hello World program in TypeScript language
let message: string = 'Hello, World!'; console.log(message);
12. GO Language
Go, also known as Golang, is a programming language developed by Google in 2009. It is designed to be a simple, efficient, and statically typed language that is easy to learn and use.
Hello World program in Go language
package main import "fmt" func main() { fmt.Println("Hello World") }
13. Rust Language
Rust is a systems programming language that was developed by Mozilla in 2010. It is designed to be a safe and concurrent language that is suitable for building low-level systems such as operating systems, device drivers, and embedded systems.
Hello World program in Rust language
fn main() { println!("Hello World"); }
14. Assembly Language (8086)
Assembly language is a low-level programming language that is used to program computer processors at the machine level. It is a symbolic representation of the machine code instructions that the processor can execute.
Hello World program in Assembly language
.MODEL SMALL .STACK 100H .DATA ;The string to be printed STRING DB 'Hello World', '$' .CODE MAIN PROC FAR MOV AX,@DATA MOV DS,AX ; load address of the string LEA DX,STRING ;output the string ;loaded in dx MOV AH,09H INT 21H ;interrupt to exit MOV AH,4CH INT 21H MAIN ENDP END MAIN
15. Swift Language
Swift is a general-purpose, compiled programming language developed by Apple for its platforms and Linux. It was first introduced in 2014 as a replacement for the Objective-C language for iOS and macOS development.
Hello World program in Swift language
// Swift "Hello, World!" Program import Foundation print("Hello, World!")
16. COBOL Language
COBOL (Common Business-Oriented Language) is a high-level programming language that was developed in the late 1950s for business data processing. It is designed to be easy to read and write and is still widely used today in various industries such as banking, insurance, and government for business-critical applications.
Hello World program in COBOL language
IDENTIFICATION DIVISION. PROGRAM-ID. Hello-world. PROCEDURE DIVISION. DISPLAY "Hello World".
17. Scala Language
Scala is a programming language that combines object-oriented and functional programming concepts. It was developed by Martin Odersky and his team in 2003, and it runs on the Java Virtual Machine (JVM).
Hello World program in Scala language
object Hello extends App { println("Hello World") }
18. Fortan Language
Fortran (short for “Formula Translation”) is a general-purpose, compiled programming language that is particularly suited for numerical and scientific computing. It was first developed in the 1950s by IBM and is still widely used today in various fields such as engineering, physics, and finance.
Hello World program in Fortan language
program helloworld print *, "Hello World" end program helloworld
So, here’s how we can write hello world program in different programming languages. Please share your thoughts in the comments.