One test case giving wrong answer

Hello @aryanv,

Your code is giving wrong output for large vales of c
Example:
56789 3452 100000

For this value of c, the value of following product is out of the range of int:
ans = ((ans%c)*(a%c));
But, as we are storing the result in a variable of type int.
Thus, it will implicitly reduce within the range of int.

Solution:

Hope, this would help.
Give a like, if you are satisfied.

1 Like