Advertisement
Alex_Zuev

Untitled

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