Advertisement
Guest User

Travelling

a guest
Jul 16th, 2018
651
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. package nestedForWhile;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class travelling {
  6. public static void main(String[] main){
  7. Scanner scanner = new Scanner(System.in);
  8. String country = scanner.nextLine();
  9.  
  10. while(!country.equals("End")){
  11. int budget = Integer.parseInt(scanner.nextLine());
  12. int sum = 0;
  13. while(budget > sum){
  14. int money = Integer.parseInt(scanner.nextLine());
  15. sum += money;
  16. money++;
  17.  
  18.  
  19. }
  20.  
  21.  
  22. }
  23.  
  24.  
  25. System.out.printf("Going to %s", country);
  26.  
  27. }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement