while solving the following problem http://www.codechef.com/problems/RECIPE
the solution for the problem - http://www.codechef.com/viewsolution/5506512
im stuck while theres an input having 3 in it.
while finding modulo of 3 by 15 it gives me 3.
while solving the following problem http://www.codechef.com/problems/RECIPE
the solution for the problem - http://www.codechef.com/viewsolution/5506512
im stuck while theres an input having 3 in it.
while finding modulo of 3 by 15 it gives me 3.
Because 3 % 15 is indeed 3
% operation output remainder of two number.
For your example i.e. 3%15 you are getting correct answer as 3
_ _ _ 15) 3 (0 -0 - - - - 3 - - - - -> This is the value % operation gives as output.. So, 3 is correct for 3%15.
hahahaha!!!
(n%m) is n if n is less than m
Check for negative numbers in that case…now am I eligible to laugh at you???