Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Arrays;
- /**
- * Created by Alex on 26.02.2015.
- */
- public class Massive {
- public static boolean Check(double a) {
- if (a - (int) a == 0)
- return true;
- else return false;
- }
- public static void main(String[] args) {
- double m[] = new double[10];
- double m2[] = new double[10];
- double m3[] = new double[10];
- for (int i = 0; i < m.length; i++) {
- m[i] = ((int) ((Math.random() * 9) + 1));
- m2[i] = ((int) ((Math.random() * 9) + 1));
- m3[i] = m[i] / m2[i];
- }
- for (int i = 0; i < m.length; i++) {
- System.out.print(m[i] + " ");
- }
- System.out.println();
- for (int i = 0; i < m.length; i++) {
- System.out.print(m2[i] + " ");
- }
- System.out.println();
- for (int i = 0; i < m.length; i++) {
- System.out.print(m3[i] + " ");
- }
- System.out.println();
- int count = 0;
- for (int i = 0; i < m3.length; i++) {
- if (Check(m3[i])){
- System.out.print(m3[i]+" ");
- count++;}
- }
- System.out.println();
- System.out.println(count);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement