I made chatGPT to write hello world program in all major languages
Tags: chatgpt, ai, python, java
Published: 2022-12-05 13:38:16

---
title: I made chatGPT to write hello world program in all major languages
published: true
description: 
tags: chatGPT,AI,python,java
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2022-12-05 13:09 +0000
---

✨_The entirety of these are generated by chatGPT, including descriptions around building and running them_ 🚀🤖✨

How awesome this is!!😎 

Read on..

---


## 1. Java
```java
public class HelloWorld {
  public static void main(String[] args) {
    System.out.println("Hello, World!");
  }
}
```
To run this program, save it in a file named `HelloWorld.java` and compile it using the `javac` command:
```bash
javac HelloWorld.java
```
This will print "Hello, World!" to the console.

## 2. JavaScript
```javascript
console.log("Hello, World!");
```
To run this program, save it in a file with a `.js` extension, such as `hello-world.js`, and run it using a JavaScript interpreter, such as Node.js:
```bash
node hello-world.js
```
This will print "Hello, World!" to the console.

## 3. Python
Here is a hello-world program in Python:
```python
print("Hello, World!")
```
To run this program, save it in a file with a `.py` extension, such as `hello-world.py`, and run it using a Python interpreter:
```bash
python hello-world.py
```
This will print "Hello, World!" to the console.

## 4. Golang
Here is a hello-world program in Go:
```go
package main

import "fmt"

func main() {
    fmt.Println("Hello, World!")
}
```
To run this program, save it in a file named `hello-world.go` and compile it using the `go build` command:
```bash
go build hello-world.go
```
This will create an executable file named `hello-world` in the same directory. Run this file to see the output:
```bash
./hello-world
```
This will print "Hello, World!" to the console.

## 5. Rust
Here is a hello-world program in Rust:
```rust
fn main() {
    println!("Hello, World!");
}
```
To run this program, save it in a file named `hello-world.rs` and compile it using the `rustc` command:
```bash
rustc hello-world.rs
```
This will create an executable file named `hello-world` in the same directory. Run this file to see the output:
```bash
./hello-world
```
This will print "Hello, World!" to the console.

## 6. C
Here is a hello-world program in C:
```c
#include <stdio.h>

int main() {
    printf("Hello, World!\n");
    return 0;
}
```
To run this program, save it in a file named `hello-world.c` and compile it using the `gcc` command:
```bash
gcc hello-world.c -o hello-world
```
This will create an executable file named `hello-world` in the same directory. Run this file to see the output:
```bash
./hello-world
```
This will print "Hello, World!" to the console.

## 7. C++
Here is a hello-world program in C++:
```c++
#include <iostream>

int main() {
    std::cout << "Hello, World!" << std::endl;
    return 0;
}
```
To run this program, save it in a file named `hello-world.cpp` and compile it using the `g++` command:
```bash
g++ hello-world.cpp -o hello-world
```
This will create an executable file named `hello-world` in the same directory. Run this file to see the output:
```bash
./hello-world
```
This will print "Hello, World!" to the console.

## 8. Ruby
Here is a hello-world program in Ruby:
```ruby
puts "Hello, World!"
```
To run this program, save it in a file with a `.rb` extension, such as `hello-world.rb`, and run it using a Ruby interpreter:
```bash
ruby hello-world.rb
```
This will print "Hello, World!" to the console.

## 9. Clojure
Here is a hello-world program in Clojure:
```clojure
(println "Hello, World!")
```
To run this program, save it in a file with a `.clj` extension, such as `hello-world.clj`, and run it using the `clojure` command:
```bash
clojure hello-world.clj
```
This will print "Hello, World!" to the console.

## 10. Elixir
Here is a hello-world program in Elixir:
```elixir
IO.puts "Hello, World!"
```
To run this program, save it in a file with a `.exs` extension, such as `hello-world.exs`, and run it using the `elixir` command:
```bash
elixir hello-world.exs
```
This will print "Hello, World!" to the console.

## 11. C-sharp
Here is a hello-world program in C#:
```c#
using System;

namespace HelloWorld
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello, World!");
        }
    }
}
```
To run this program, save it in a file named `HelloWorld.cs` and compile it using the `csc` command:
```bash
csc HelloWorld.cs
```
This will create an executable file named `HelloWorld.exe` in the same directory. Run this file to see the output:
```bash
HelloWorld.exe
```
This will print "Hello, World!" to the console.

## 12. PHP
Here is a hello-world program in PHP:
```php
<?php

echo "Hello, World!";
```
To run this program, save it in a file with a `.php` extension, such as `hello-world.php`, and run it using the `php` command:
```bash
php hello-world.php
```
This will print "Hello, World!" to the console.

## 13. Perl
Here is a hello-world program in Perl:
```perl
use strict;
use warnings;

print "Hello, World!\n";
```
To run this program, save it in a file with a `.pl` extension, such as `hello-world.pl`, and run it using the `perl` command:
```bash
perl hello-world.pl
```
This will print "Hello, World!" to the console.

## 14. Swift
Here is a hello-world program in Swift:
```swift
print("Hello, World!")
```
To run this program, save it in a file with a `.swift` extension, such as `hello-world.swift`, and run it using the `swift` command:
```bash
swift hello-world.swift
```
This will print "Hello, World!" to the console.

## 15. Objective-C
Here is a hello-world program in Objective-C:
```objective-c
#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        NSLog(@"Hello, World!");
    }
    return 0;
}
```
To run this program, save it in a file named `hello-world.m` and compile it using the `clang` command:
```bash
clang -fobjc-arc hello-world.m -o hello-world
```
This will create an executable file named `hello-world` in the same directory. Run this file to see the output:
```bash
./hello-world
```
This will print "Hello, World!" to the console.

## 16. Kotlin
Here is a hello-world program in Kotlin:
```kotlin
fun main() {
    println("Hello, World!")
}
```
To run this program, save it in a file with a `.kt` extension, such as `hello-world.kt`, and compile it using the `kotlinc` command:
```bash
kotlinc hello-world.kt -include-runtime -d hello-world.jar
```
This will create a JAR file named `hello-world.jar` in the same directory. Run this file to see the output:
```bash
java -jar hello-world.jar
```
This will print "Hello, World!" to the console.

## 17. Scala
Here is a hello-world program in Scala:
```scala
object HelloWorld {
  def main(args: Array[String]): Unit = {
    println("Hello, World!")
  }
}
```
To run this program, save it in a file with a `.scala` extension, such as `hello-world.scala`, and compile it using the `scalac` command:
```bash
scalac hello-world.scala
```
This will create a class file named `HelloWorld.class` in the same directory. Run this file using the `scala` command:
```bash
scala HelloWorld
```
This will print "Hello, World!" to the console.