There is a task
Create two arrays of 10 whole random numbers from the segment [1; 9] and a third array of 10 real numbers. Each element with the i-th index of the third array must be equal to the ratio of the element from the first array with the i-th index to the element from the second array with the i-th index. Print all three arrays on the screen (each on a separate line), then print the number of whole elements in the third array.
public class Main { public static void main(String[] args) { int[] massivOne = new int[10]; int[] massivTwo = new int[10]; double[] massivThree = new double[10]; for (int i = 0; i < 10; i++){ massivOne[i] = (int)(Math.random()*8 +1); massivTwo[i] = (int)(Math.random()*8 +1); massivThree[i]= massivOne[i]/massivTwo[i]; } for (int i = 0; i < 10; i++){ System.out.print(massivOne[i] + " "); } System.out.println(); for (int i = 0; i < 10; i++){ System.out.print(massivTwo[i] + " "); } System.out.println(); for (int i = 0; i < 10; i++){ System.out.print(massivThree[i] + " "); } System.out.println(); } }
I can not figure out how to properly check for integrity? and is the rest of the solution correct? Thanks in advance for the hint :)