Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Stupki {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- String input = "";
- int totalSteps = 0;
- int steps = 0;
- while (totalSteps <= 10000) {
- input = scan.nextLine();
- steps = Integer.parseInt(input);
- totalSteps += steps;
- if ("Going home".equals(input)) {
- input = scan.nextLine();
- steps = Integer.parseInt(input);
- totalSteps += steps;
- break;
- }
- }
- if (totalSteps >= 10000) {
- System.out.println("Goal reached! Good job!");
- } else if (totalSteps < 10000) {
- System.out.printf("%d more steps to reach goal.",(10000 - totalSteps));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement