Mishakis

Mock1_3

Oct 14th, 2018
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.56 KB | None | 0 0
  1.  
  2.  
  3.  
  4. import java.util.Scanner;
  5.  
  6.  
  7. public class Main {
  8.  
  9.  
  10.  
  11.     public static void main(String[] args) {
  12.         Scanner scanner = new Scanner(System.in);
  13.  
  14.         int sum = 0;
  15.  
  16.         while(true){
  17.             String number = scanner.nextLine();
  18.             int a = number.charAt(0) - '0';
  19.             int b = number.charAt(1) - '0';
  20.             int c = number.charAt(2) - '0';
  21.  
  22.             if(a+c != b){
  23.                 break;
  24.             }
  25.  
  26.             sum +=  Integer.parseInt(number);
  27.         }
  28.         System.out.println(sum);
  29.     }
  30.  
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment