-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInput.java
More file actions
40 lines (23 loc) · 725 Bytes
/
Input.java
File metadata and controls
40 lines (23 loc) · 725 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import java.util.Scanner;
public class Input {
public static void main(String args[]) {
Scanner kb = new Scanner(System.in);
for(int i = args.length -1 ; i >= 0; i--)
System.out.print(args[i] + ' ');
System.out.println();
System.out.print("Enter your first name: ");
String fname = kb.next();
System.out.print("Enter the rest of your name: ");
kb.nextLine();
String name = kb.nextLine();
System.out.println("Hello " + fname + ' ' + name + "!");
int a, b;
System.out.print("Enter two numbers: ");
a = kb.nextInt();
b = kb.nextInt();
System.out.println(a + " + " + b + " = " + (a + b) + ".");
int x = 17, y = 12;
double q = 14.3;
System.out.println(x/y +q);
}
}