** * File: DigitSum.java */ public void run() {
description
Transcript of ** * File: DigitSum.java */ public void run() {
![Page 1: ** * File: DigitSum.java */ public void run() {](https://reader033.fdocuments.net/reader033/viewer/2022061423/568161b2550346895dd17863/html5/thumbnails/1.jpg)
/** * File: DigitSum.java */
public void run() { int number = readInt("Enter a number greater than 0: "); if (number <= 0) { println("Your response should have been positive."); println("You're no fun to play number games with."); return; // end prematurely without continuing }
int digitSum = 0; int n = number; while (n > 0) { int digit = n % 10; digitSum += digit; n /= 10; }
println("The sum of the digits making up " + number + " is " + digitSum + "."); println("Thanks for playing. :)");}
![Page 2: ** * File: DigitSum.java */ public void run() {](https://reader033.fdocuments.net/reader033/viewer/2022061423/568161b2550346895dd17863/html5/thumbnails/2.jpg)
/** * File: DigitSum.java */
public void run() { int number = readInt("Enter a number greater than 0: "); if (number <= 0) { println("Your response should have been positive."); println("You're no fun to play number games with."); return; // end prematurely without continuing }
int digitSum = 0; int n = number; while (n > 0) { int digit = n % 10; digitSum += digit; n /= 10; }
println("The sum of the digits making up " + number + " is " + digitSum + "."); println("Thanks for playing. :)");}
![Page 3: ** * File: DigitSum.java */ public void run() {](https://reader033.fdocuments.net/reader033/viewer/2022061423/568161b2550346895dd17863/html5/thumbnails/3.jpg)
/** * File: DigitSum.java */
public void run() { int number = readInt("Enter a number greater than 0: "); if (number <= 0) { println("Your response should have been positive."); println("You're no fun to play number games with."); return; // end prematurely without continuing }
int digitSum = 0; int n = number; while (n > 0) { int digit = n % 10; digitSum += digit; n /= 10; }
println("The sum of the digits making up " + number + " is " + digitSum + "."); println("Thanks for playing. :)");}
1729 number
![Page 4: ** * File: DigitSum.java */ public void run() {](https://reader033.fdocuments.net/reader033/viewer/2022061423/568161b2550346895dd17863/html5/thumbnails/4.jpg)
/** * File: DigitSum.java */
public void run() { int number = readInt("Enter a number greater than 0: "); if (number <= 0) { println("Your response should have been positive."); println("You're no fun to play number games with."); return; // end prematurely without continuing }
int digitSum = 0; int n = number; while (n > 0) { int digit = n % 10; digitSum += digit; n /= 10; }
println("The sum of the digits making up " + number + " is " + digitSum + "."); println("Thanks for playing. :)");}
1729 number
![Page 5: ** * File: DigitSum.java */ public void run() {](https://reader033.fdocuments.net/reader033/viewer/2022061423/568161b2550346895dd17863/html5/thumbnails/5.jpg)
/** * File: DigitSum.java */
public void run() { int number = readInt("Enter a number greater than 0: "); if (number <= 0) { println("Your response should have been positive."); println("You're no fun to play number games with."); return; // end prematurely without continuing }
int digitSum = 0; int n = number; while (n > 0) { int digit = n % 10; digitSum += digit; n /= 10; }
println("The sum of the digits making up " + number + " is " + digitSum + "."); println("Thanks for playing. :)");}
1729 number
0 digitSum
![Page 6: ** * File: DigitSum.java */ public void run() {](https://reader033.fdocuments.net/reader033/viewer/2022061423/568161b2550346895dd17863/html5/thumbnails/6.jpg)
/** * File: DigitSum.java */
public void run() { int number = readInt("Enter a number greater than 0: "); if (number <= 0) { println("Your response should have been positive."); println("You're no fun to play number games with."); return; // end prematurely without continuing }
int digitSum = 0; int n = number; while (n > 0) { int digit = n % 10; digitSum += digit; n /= 10; }
println("The sum of the digits making up " + number + " is " + digitSum + "."); println("Thanks for playing. :)");}
1729 number
0 digitSum
1729 n
![Page 7: ** * File: DigitSum.java */ public void run() {](https://reader033.fdocuments.net/reader033/viewer/2022061423/568161b2550346895dd17863/html5/thumbnails/7.jpg)
/** * File: DigitSum.java */
public void run() { int number = readInt("Enter a number greater than 0: "); if (number <= 0) { println("Your response should have been positive."); println("You're no fun to play number games with."); return; // end prematurely without continuing }
int digitSum = 0; int n = number; while (n > 0) { int digit = n % 10; digitSum += digit; n /= 10; }
println("The sum of the digits making up " + number + " is " + digitSum + "."); println("Thanks for playing. :)");}
1729 number
0 digitSum
1729 n
![Page 8: ** * File: DigitSum.java */ public void run() {](https://reader033.fdocuments.net/reader033/viewer/2022061423/568161b2550346895dd17863/html5/thumbnails/8.jpg)
/** * File: DigitSum.java */
public void run() { int number = readInt("Enter a number greater than 0: "); if (number <= 0) { println("Your response should have been positive."); println("You're no fun to play number games with."); return; // end prematurely without continuing }
int digitSum = 0; int n = number; while (n > 0) { int digit = n % 10; digitSum += digit; n /= 10; }
println("The sum of the digits making up " + number + " is " + digitSum + "."); println("Thanks for playing. :)");}
1729 number
0 digitSum
1729 n
9 digit
![Page 9: ** * File: DigitSum.java */ public void run() {](https://reader033.fdocuments.net/reader033/viewer/2022061423/568161b2550346895dd17863/html5/thumbnails/9.jpg)
/** * File: DigitSum.java */
public void run() { int number = readInt("Enter a number greater than 0: "); if (number <= 0) { println("Your response should have been positive."); println("You're no fun to play number games with."); return; // end prematurely without continuing }
int digitSum = 0; int n = number; while (n > 0) { int digit = n % 10; digitSum += digit; n /= 10; }
println("The sum of the digits making up " + number + " is " + digitSum + "."); println("Thanks for playing. :)");}
1729 number
9 digitSum
1729 n
9 digit
![Page 10: ** * File: DigitSum.java */ public void run() {](https://reader033.fdocuments.net/reader033/viewer/2022061423/568161b2550346895dd17863/html5/thumbnails/10.jpg)
/** * File: DigitSum.java */
public void run() { int number = readInt("Enter a number greater than 0: "); if (number <= 0) { println("Your response should have been positive."); println("You're no fun to play number games with."); return; // end prematurely without continuing }
int digitSum = 0; int n = number; while (n > 0) { int digit = n % 10; digitSum += digit; n /= 10; }
println("The sum of the digits making up " + number + " is " + digitSum + "."); println("Thanks for playing. :)");}
1729 number
9 digitSum
172 n
9 digit
![Page 11: ** * File: DigitSum.java */ public void run() {](https://reader033.fdocuments.net/reader033/viewer/2022061423/568161b2550346895dd17863/html5/thumbnails/11.jpg)
/** * File: DigitSum.java */
public void run() { int number = readInt("Enter a number greater than 0: "); if (number <= 0) { println("Your response should have been positive."); println("You're no fun to play number games with."); return; // end prematurely without continuing }
int digitSum = 0; int n = number; while (n > 0) { int digit = n % 10; digitSum += digit; n /= 10; }
println("The sum of the digits making up " + number + " is " + digitSum + "."); println("Thanks for playing. :)");}
1729 number
9 digitSum
172 n
![Page 12: ** * File: DigitSum.java */ public void run() {](https://reader033.fdocuments.net/reader033/viewer/2022061423/568161b2550346895dd17863/html5/thumbnails/12.jpg)
/** * File: DigitSum.java */
public void run() { int number = readInt("Enter a number greater than 0: "); if (number <= 0) { println("Your response should have been positive."); println("You're no fun to play number games with."); return; // end prematurely without continuing }
int digitSum = 0; int n = number; while (n > 0) { int digit = n % 10; digitSum += digit; n /= 10; }
println("The sum of the digits making up " + number + " is " + digitSum + "."); println("Thanks for playing. :)");}
1729 number
9 digitSum
172 n
2 digit
![Page 13: ** * File: DigitSum.java */ public void run() {](https://reader033.fdocuments.net/reader033/viewer/2022061423/568161b2550346895dd17863/html5/thumbnails/13.jpg)
/** * File: DigitSum.java */
public void run() { int number = readInt("Enter a number greater than 0: "); if (number <= 0) { println("Your response should have been positive."); println("You're no fun to play number games with."); return; // end prematurely without continuing }
int digitSum = 0; int n = number; while (n > 0) { int digit = n % 10; digitSum += digit; n /= 10; }
println("The sum of the digits making up " + number + " is " + digitSum + "."); println("Thanks for playing. :)");}
1729 number
11 digitSum
172 n
2 digit
![Page 14: ** * File: DigitSum.java */ public void run() {](https://reader033.fdocuments.net/reader033/viewer/2022061423/568161b2550346895dd17863/html5/thumbnails/14.jpg)
/** * File: DigitSum.java */
public void run() { int number = readInt("Enter a number greater than 0: "); if (number <= 0) { println("Your response should have been positive."); println("You're no fun to play number games with."); return; // end prematurely without continuing }
int digitSum = 0; int n = number; while (n > 0) { int digit = n % 10; digitSum += digit; n /= 10; }
println("The sum of the digits making up " + number + " is " + digitSum + "."); println("Thanks for playing. :)");}
1729 number
11 digitSum
17 n
2 digit
![Page 15: ** * File: DigitSum.java */ public void run() {](https://reader033.fdocuments.net/reader033/viewer/2022061423/568161b2550346895dd17863/html5/thumbnails/15.jpg)
/** * File: DigitSum.java */
public void run() { int number = readInt("Enter a number greater than 0: "); if (number <= 0) { println("Your response should have been positive."); println("You're no fun to play number games with."); return; // end prematurely without continuing }
int digitSum = 0; int n = number; while (n > 0) { int digit = n % 10; digitSum += digit; n /= 10; }
println("The sum of the digits making up " + number + " is " + digitSum + "."); println("Thanks for playing. :)");}
1729 number
11 digitSum
17 n
![Page 16: ** * File: DigitSum.java */ public void run() {](https://reader033.fdocuments.net/reader033/viewer/2022061423/568161b2550346895dd17863/html5/thumbnails/16.jpg)
/** * File: DigitSum.java */
public void run() { int number = readInt("Enter a number greater than 0: "); if (number <= 0) { println("Your response should have been positive."); println("You're no fun to play number games with."); return; // end prematurely without continuing }
int digitSum = 0; int n = number; while (n > 0) { int digit = n % 10; digitSum += digit; n /= 10; }
println("The sum of the digits making up " + number + " is " + digitSum + "."); println("Thanks for playing. :)");}
1729 number
11 digitSum
17 n
7 digit
![Page 17: ** * File: DigitSum.java */ public void run() {](https://reader033.fdocuments.net/reader033/viewer/2022061423/568161b2550346895dd17863/html5/thumbnails/17.jpg)
/** * File: DigitSum.java */
public void run() { int number = readInt("Enter a number greater than 0: "); if (number <= 0) { println("Your response should have been positive."); println("You're no fun to play number games with."); return; // end prematurely without continuing }
int digitSum = 0; int n = number; while (n > 0) { int digit = n % 10; digitSum += digit; n /= 10; }
println("The sum of the digits making up " + number + " is " + digitSum + "."); println("Thanks for playing. :)");}
1729 number
18 digitSum
17 n
7 digit
![Page 18: ** * File: DigitSum.java */ public void run() {](https://reader033.fdocuments.net/reader033/viewer/2022061423/568161b2550346895dd17863/html5/thumbnails/18.jpg)
/** * File: DigitSum.java */
public void run() { int number = readInt("Enter a number greater than 0: "); if (number <= 0) { println("Your response should have been positive."); println("You're no fun to play number games with."); return; // end prematurely without continuing }
int digitSum = 0; int n = number; while (n > 0) { int digit = n % 10; digitSum += digit; n /= 10; }
println("The sum of the digits making up " + number + " is " + digitSum + "."); println("Thanks for playing. :)");}
1729 number
18 digitSum
1 n
7 digit
![Page 19: ** * File: DigitSum.java */ public void run() {](https://reader033.fdocuments.net/reader033/viewer/2022061423/568161b2550346895dd17863/html5/thumbnails/19.jpg)
/** * File: DigitSum.java */
public void run() { int number = readInt("Enter a number greater than 0: "); if (number <= 0) { println("Your response should have been positive."); println("You're no fun to play number games with."); return; // end prematurely without continuing }
int digitSum = 0; int n = number; while (n > 0) { int digit = n % 10; digitSum += digit; n /= 10; }
println("The sum of the digits making up " + number + " is " + digitSum + "."); println("Thanks for playing. :)");}
1729 number
18 digitSum
1 n
7 digit
![Page 20: ** * File: DigitSum.java */ public void run() {](https://reader033.fdocuments.net/reader033/viewer/2022061423/568161b2550346895dd17863/html5/thumbnails/20.jpg)
/** * File: DigitSum.java */
public void run() { int number = readInt("Enter a number greater than 0: "); if (number <= 0) { println("Your response should have been positive."); println("You're no fun to play number games with."); return; // end prematurely without continuing }
int digitSum = 0; int n = number; while (n > 0) { int digit = n % 10; digitSum += digit; n /= 10; }
println("The sum of the digits making up " + number + " is " + digitSum + "."); println("Thanks for playing. :)");}
1729 number
18 digitSum
1 n
![Page 21: ** * File: DigitSum.java */ public void run() {](https://reader033.fdocuments.net/reader033/viewer/2022061423/568161b2550346895dd17863/html5/thumbnails/21.jpg)
/** * File: DigitSum.java */
public void run() { int number = readInt("Enter a number greater than 0: "); if (number <= 0) { println("Your response should have been positive."); println("You're no fun to play number games with."); return; // end prematurely without continuing }
int digitSum = 0; int n = number; while (n > 0) { int digit = n % 10; digitSum += digit; n /= 10; }
println("The sum of the digits making up " + number + " is " + digitSum + "."); println("Thanks for playing. :)");}
1729 number
18 digitSum
1 n
1 digit
![Page 22: ** * File: DigitSum.java */ public void run() {](https://reader033.fdocuments.net/reader033/viewer/2022061423/568161b2550346895dd17863/html5/thumbnails/22.jpg)
/** * File: DigitSum.java */
public void run() { int number = readInt("Enter a number greater than 0: "); if (number <= 0) { println("Your response should have been positive."); println("You're no fun to play number games with."); return; // end prematurely without continuing }
int digitSum = 0; int n = number; while (n > 0) { int digit = n % 10; digitSum += digit; n /= 10; }
println("The sum of the digits making up " + number + " is " + digitSum + "."); println("Thanks for playing. :)");}
1729 number
19 digitSum
1 n
1 digit
![Page 23: ** * File: DigitSum.java */ public void run() {](https://reader033.fdocuments.net/reader033/viewer/2022061423/568161b2550346895dd17863/html5/thumbnails/23.jpg)
/** * File: DigitSum.java */
public void run() { int number = readInt("Enter a number greater than 0: "); if (number <= 0) { println("Your response should have been positive."); println("You're no fun to play number games with."); return; // end prematurely without continuing }
int digitSum = 0; int n = number; while (n > 0) { int digit = n % 10; digitSum += digit; n /= 10; }
println("The sum of the digits making up " + number + " is " + digitSum + "."); println("Thanks for playing. :)");}
1729 number
19 digitSum
0 n
1 digit
![Page 24: ** * File: DigitSum.java */ public void run() {](https://reader033.fdocuments.net/reader033/viewer/2022061423/568161b2550346895dd17863/html5/thumbnails/24.jpg)
/** * File: DigitSum.java */
public void run() { int number = readInt("Enter a number greater than 0: "); if (number <= 0) { println("Your response should have been positive."); println("You're no fun to play number games with."); return; // end prematurely without continuing }
int digitSum = 0; int n = number; while (n > 0) { int digit = n % 10; digitSum += digit; n /= 10; }
println("The sum of the digits making up " + number + " is " + digitSum + "."); println("Thanks for playing. :)");}
1729 number
19 digitSum
0 n
![Page 25: ** * File: DigitSum.java */ public void run() {](https://reader033.fdocuments.net/reader033/viewer/2022061423/568161b2550346895dd17863/html5/thumbnails/25.jpg)
/** * File: DigitSum.java */
public void run() { int number = readInt("Enter a number greater than 0: "); if (number <= 0) { println("Your response should have been positive."); println("You're no fun to play number games with."); return; // end prematurely without continuing }
int digitSum = 0; int n = number; while (n > 0) { int digit = n % 10; digitSum += digit; n /= 10; }
println("The sum of the digits making up " + number + " is " + digitSum + "."); println("Thanks for playing. :)");}
1729 number
19 digitSum
0 n
![Page 26: ** * File: DigitSum.java */ public void run() {](https://reader033.fdocuments.net/reader033/viewer/2022061423/568161b2550346895dd17863/html5/thumbnails/26.jpg)
/** * File: DigitSum.java */
public void run() { int number = readInt("Enter a number greater than 0: "); if (number <= 0) { println("Your response should have been positive."); println("You're no fun to play number games with."); return; // end prematurely without continuing }
int digitSum = 0; int n = number; while (n > 0) { int digit = n % 10; digitSum += digit; n /= 10; }
println("The sum of the digits making up " + number + " is " + digitSum + "."); println("Thanks for playing. :)");}
1729 number
19 digitSum
0 n