Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package nestedForWhile;
- import java.util.Scanner;
- public class travelling {
- public static void main(String[] main){
- Scanner scanner = new Scanner(System.in);
- String country = scanner.nextLine();
- while(!country.equals("End")){
- int budget = Integer.parseInt(scanner.nextLine());
- int sum = 0;
- while(budget > sum){
- int money = Integer.parseInt(scanner.nextLine());
- sum += money;
- money++;
- }
- }
- System.out.printf("Going to %s", country);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement