forked from txs72/JavaTutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSentinelValue.java
More file actions
executable file
·35 lines (33 loc) · 955 Bytes
/
SentinelValue.java
File metadata and controls
executable file
·35 lines (33 loc) · 955 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
/* */ package ch05;
/* */
/* */ import java.util.Scanner;
/* */
/* */
/* */ public class SentinelValue
/* */ {
/* */ public static void main(String[] args) {
/* 9 */ Scanner input = new Scanner(System.in);
/* */
/* */
/* 12 */ System.out.print("Enter an integer (the input ends if it is 0): ");
/* */
/* 14 */ int data = input.nextInt();
/* */
/* */
/* 17 */ int sum = 0;
/* 18 */ while (data != 0) {
/* 19 */ sum += data;
/* */
/* */
/* 22 */ System.out.print("Enter an integer (the input ends if it is 0): ");
/* */
/* 24 */ data = input.nextInt();
/* */ }
/* */
/* 27 */ System.out.println("The sum is " + sum);
/* */ }
/* */ }
/* Location: /Volumes/TXS.128G/hope useful/practice/2020.jar!/ch05/SentinelValue.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/