C
Java
Python
JavaScript
Swift

Assigned Input (Java)

public class Main {
public static void main(String[] args) {
    String name = "Khushal Digrase";
    System.out.println("Hello, " + name + "!");
}
}

Output

Hello, Khushal Digrase!

Terminal Input (Java)

import java.util.Scanner;

public class Main {
public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    System.out.print("Enter your name: ");
    String name = scanner.nextLine();
    System.out.println("Hello, " + name + "!");
}
}

Output

Enter your name: Khushal
Hello, Khushal!

Assigned Input (Python)

name = "Khushal"
print("Hello, " + name + "!")

Output

Hello, Khushal!

Terminal Input (Python)

name = input("Enter your name: ")
print("Hello, " + name + "!")

Output

Enter your name: Khushal D
Hello, Khushal D!

Assigned Input (Swift)

let name = "Khushal D"
print("Hello, \(name)!")

Output

Hello, Khushal D!

Terminal Input (Swift)

import Foundation

print("Enter your name: ", terminator: "")
if let name = readLine() {
print("Hello, \(name)!")
}

Output

Enter your name: Khushal
Hello, Khushal!

Assigned Input (C)

#include <stdio.h>

int main() {
char name[] = "Khushal";
printf("Hello, %s!\n", name);
return 0;
}

Output

Hello, Khushal!

Terminal Input (C)

#include <stdio.h>

int main() {
char name[50];
printf("Enter your name: ");
scanf("%s", name);
printf("Hello, %s!\n", name);
return 0;
}

Output

Enter your name: Khushal
Hello, Khushal!

Form Input (JS)

function JavaScript() {
let name = document.getElementById("javaScript-input").value;
document.getElementById("javascript-output").innerHTML = "Hello, " + name + "!";
}

Output

The output will be displayed here

Prompt (JS)

function promptAlert() {
let name = prompt("Enter your name:");
if (name) {
alert("Hello, " + name + "!");
document.getElementById("prompt-output").innerHTML = "Hello, " + name + "!";
}
}

Output

Output will display after the alert.

Alert (JS)

function alertFunction() {
alert("Hello from the Alert!");
document.getElementById("alert-output").innerHTML = "Hello from the Alert!";
}

Output

Click button for alert output

Direct Assignment (JS)

function directAssignment() {
let name = "Khushal";
document.getElementById("direct-output").innerHTML = "Hello, " + name + "!";
}

Output

Click to show output