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

3rd Oct 2021, 5:16 PM
Bobby Dike
Bobby Dike - avatar
5 Respostas
+ 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
3rd Oct 2021, 5:40 PM
Coding Cat
Coding Cat - avatar
+ 1
thank you
3rd Oct 2021, 5:43 PM
Bobby Dike
Bobby Dike - avatar
+ 1
okay
3rd Oct 2021, 5:43 PM
Bobby Dike
Bobby Dike - avatar
0
And your print statements are sometimes not correct System.out.printf("%-6d"); must be System.out.printf("%-6d", R[i]);
3rd Oct 2021, 5:43 PM
Coding Cat
Coding Cat - avatar
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
3rd Oct 2021, 6:17 PM
Bobby Dike
Bobby Dike - avatar