Advertisement
Alex_Zuev

Untitled

Feb 27th, 2015
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.83 KB | None | 0 0
  1. package com.company;
  2. import java.util.Arrays;
  3. import java.util.Scanner;
  4. /**
  5.  * Created by Alex on 26.02.2015.
  6.  */
  7. public class Massive {
  8.  
  9.  
  10.     public static void main(String[] args) {
  11.         int m[] = new int[12];
  12.  
  13.         for (int j = 0; j < 1; ) {
  14.             int countPlus = 0;
  15.             int cjuntMinus =0;
  16.  
  17.             for (int i = 0; i < m.length; ) {
  18.                 m[i] = ((int) ((Math.random() * 21) - 10));
  19.                 if (m[i] > 0) {
  20.                     i++;
  21.                     countPlus++;
  22.                 } else if (m[i] < 0){
  23.                     i++;
  24.                 cjuntMinus++;}
  25.  
  26.             }
  27.             if (countPlus == cjuntMinus) {
  28.                 j++;
  29.             }
  30.  
  31.         }
  32.         for (int i = 0; i < m.length; i++) {
  33.             System.out.print(m[i] + " ");
  34.  
  35.         }
  36.  
  37.     }
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement