- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExercise11.java
More file actions
Latest commit
14 lines (11 loc) · 527 Bytes
/
Copy pathExercise11.java
File metadata and controls
14 lines (11 loc) · 527 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
publicclassExercise11 {
publicstaticvoidmain(Stringarg[]) {
// Write a program that asks the user to enter a three digit integer,
// then prints out the sum of the three digits. For example,
// if the user enters 372, the program would print 3+7+2 = 12.
// Hint: Use division and modulo (aka "remainder-after-division").
System.out.print("Enter a number between 100 and 999: ");
intx = StdIn.readInt();
// Add your code here, then click "run" to test it.
}
}