Advertisement
TopMo3ulla

Untitled

Aug 8th, 2022
967
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.54 KB | None | 0 0
  1. package com.yeliseyenka.lesson2;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Test2 {
  6.     public static void main(String[] args) {
  7.  
  8.         Scanner scanner = new Scanner(System.in);
  9.         int i;
  10.         int sum = 0;
  11.  
  12.         i = scanner.nextInt();
  13.  
  14.         if (i > 0) {
  15.             sum += i;
  16.         }
  17.  
  18.  
  19.         i = scanner.nextInt();
  20.  
  21.         if (i > 0) {
  22.             sum += i;
  23.         }
  24.  
  25.  
  26.         i = scanner.nextInt();
  27.  
  28.         if (i > 0) {
  29.             sum += i;
  30.         }
  31.  
  32.  
  33.         System.out.println(sum);
  34.     }
  35. }
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement