Advertisement
bogolyubskiyalexey

Calc numbers. Example good.

Sep 7th, 2017
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.63 KB | None | 0 0
  1. import java.util.Scanner;
  2. import java.io.IOException;
  3.  
  4. public class Main {
  5.     public static void main(String[] args) throws Exception {
  6.         Scanner scan = new Scanner(System.in);
  7.         final int N = 3;
  8.         int a=0, b=0;
  9.         for (int i=0; i < N; i++)
  10.         {
  11.             int value = scan.nextInt();
  12.             if (value > 0)
  13.                 a++;
  14.             if (value < 0)
  15.                 b++;
  16.         }
  17.         System.out.println("количество отрицательных чисел: "+b);
  18.         System.out.println("количество положительных чисел: "+a);
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement