0
divisible by three and five
ive added some other statements but its not working, and it also calculates the numbers divisible by three and five from the array size instead of the random numbers in the array. https://code.sololearn.com/cW0ZS0KpKb4W/?ref=app
5 Respuestas
+ 1
Have a look at this:
The loops are only for cout the index up ( i or n from 0 to R.length - 1) . This loop variable has not to be checkt for divisibility. Only the values in R[] have to be checked.
if R[i] % 3 == 0 or
if R[i] % 5 == 0 and so on.
https://code.sololearn.com/c3mQSHEGpbjM/?ref=app
+ 1
thank you
+ 1
okay
0
And your print statements are sometimes not correct
System.out.printf("%-6d");
must be
System.out.printf("%-6d", R[i]);
0
count the number of times each number appears in the array
i want my code to count how many times each number appears in the array.
How do i do that?
https://code.sololearn.com/cW0ZS0KpKb4W/?ref=app