-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNumberToWords.java
More file actions
46 lines (42 loc) · 1.07 KB
/
NumberToWords.java
File metadata and controls
46 lines (42 loc) · 1.07 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import java.util.Scanner;
public class NumberToWords {
public static void main (String[] args) {
Scanner keyboardInput = new Scanner(System.in);
System.out.print("Enter a number between 1 to 10: ");
int enteredNum = keyboardInput.nextInt();
//Condition statement
if (enteredNum == 1) {
System.out.print("You entered: One");
}
else if (enteredNum == 2) {
System.out.print("You entered: Two");
}
else if (enteredNum == 3) {
System.out.print("You entered: Three");
}
else if (enteredNum == 4) {
System.out.print("You entered: Four");
}
else if (enteredNum == 5) {
System.out.print("You entered: Five");
}
else if (enteredNum == 6) {
System.out.print("You entered: Six");
}
else if (enteredNum == 7) {
System.out.print("You entered: Seven");
}
else if (enteredNum == 8) {
System.out.print("You entered: Eight");
}
else if (enteredNum == 9) {
System.out.print("You entered: Nine");
}
else if (enteredNum == 10) {
System.out.print("You entered: Ten");
}
else {
System.out.print("You entered an invalid number");
}
}
}