Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int sum = 0;
- while(true){
- String number = scanner.nextLine();
- int a = number.charAt(0) - '0';
- int b = number.charAt(1) - '0';
- int c = number.charAt(2) - '0';
- if(a+c != b){
- break;
- }
- sum += Integer.parseInt(number);
- }
- System.out.println(sum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment