Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- import java.util.Scanner;
- public class task20 {
- public static void main(String[] args) {
- int n, k;
- int counter1 = 0;
- int counter2 = 0;
- int counter3 = 0;
- Random rand = new Random();
- Scanner in = new Scanner(System.in);
- n = in.nextInt();
- k = in.nextInt();
- int[] array = new int[n];
- for (int i = 0; i < n; i++) {
- array[i] = rand.nextInt(-100, 100);
- if (array[i] > 0) counter1++;
- if (array[i] < 0) counter2++;
- else counter3++;
- }
- System.out.println(counter1 + " " + counter2 + " " + counter3);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement