Hello, I am Jarin, who has been studying Java for 3 days now. There are many answers when I google it, but I'm so curious why I can't solve it.
This is question 3052 from Java When there are two natural numbers A and B, A%B is the remainder of A divided by B. For example, 7, 14, 27, 38 divided by 3 and the remainder is 1, 2, 0, and 2.
After receiving 10 numbers, find the remainder divided by 42. Then write a program that outputs how many different values there are.
I solved the problem like this, but I get a runtime error.
Why can't you count when i and i+1 are different...?java
If it's 0, 1, 0, 1, 0, 1, it's two, but your code is five.
© 2022 pinfo. All rights reserved.