BetinaUKTC

zadacha6

Apr 14th, 2021
491
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package Prog;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Prog_Main {
  6.  
  7.     public static void main(String[] args) {
  8.         Scanner scan = new Scanner(System.in);
  9.         String[] input = scan.nextLine().split(" ");
  10.         int sum = 0;
  11.         for (int i = 0; i < input.length; i++) {
  12.             String currentNum ="";
  13.             for (int j = input[i].length()-1; j >= 0; j--) {
  14.                 if (!String.valueOf(input[i].charAt(j)).equals("0")) {
  15.                     currentNum += String.valueOf(input[i].charAt(j));
  16.                 }
  17.             }
  18.             sum+=Integer.parseInt(currentNum);
  19.  
  20.         }
  21.         System.out.println(sum);
  22.     }
  23. }
  24.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×