-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScannerAJ.java
More file actions
39 lines (20 loc) · 726 Bytes
/
Copy pathScannerAJ.java
File metadata and controls
39 lines (20 loc) · 726 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
31
32
33
34
35
36
37
38
39
// Jain Aarush
// February 10 2019
// Assignment 4: Using Scanner for exercise 7
// ICS3U7 Mrs.Strelkovska
import java.util.Scanner;
public class ScannerAJ {
public static void main(String[] args) {
int number = 0;
Scanner object1 = new Scanner(System.in);
System.out.print("Enter a three-digit number: ");
number = object1.nextInt();
int hundreds = number / 100;
int tens = (number - hundreds * 100) / 10;
int ones = (number - hundreds * 100 - tens * 10);
System.out.println("");
System.out.println("The hundreds-place digit is: " + hundreds);
System.out.println("The tens-place digit is: " + tens);
System.out.println("The ones-place digit is: " + ones);
}
}