Advertisement
Azazavr

javarush.test.level04.lesson07.task03

Oct 22nd, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.92 KB | None | 0 0
  1. package com.javarush.test.level04.lesson07.task03;
  2.  
  3. /* Положительные числа
  4. Ввести с клавиатуры три целых числа. Вывести на экран количество положительных чисел в исходном наборе.
  5. Пример для чисел -4 6 6:
  6. 2
  7. Пример для чисел -6 -6 -3:
  8. 0
  9. */
  10.  
  11. import java.io.*;
  12.  
  13. public class Solution
  14. {
  15.     public static void main(String[] args) throws Exception
  16.     {
  17.         BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
  18.  
  19.         int a,b,c,d;
  20.  
  21.         a = Integer.parseInt(reader.readLine());
  22.         b = Integer.parseInt(reader.readLine());
  23.         c = Integer.parseInt(reader.readLine());
  24.         d = 0;
  25.  
  26.         if (a > 0)
  27.             d+=1;
  28.         if (b > 0)
  29.             d+=1;
  30.         if (c > 0)
  31.             d+=1;
  32.  
  33.         System.out.println(d);
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement