+ 1
Can you guys plz help me that how does this calculation result come 5
public class Program { public static void main(String[] args) { int value = 23; int res = value % 6; System.out.println(res); } }
2 Answers
+ 12
% (modulus) gives the remainder after the division of any two numbers. Here, you divide 23 by 6. After the division, the remainder which is left out is 5 as 6*3 = 18 and 23-18 = 5. It never takes 6*4 = 24 as it will exceed 23 (the numerator).
P.S. It results to the remainder after the division of 23 by 6 ^^
+ 2
ooooo.. thank you so much buddy.. you are so helpful