0
C++, How 3 (Help) I tried but I don't know how 3%5 output comes 3
Int a=3; Int b=a++; Cout<<b%++a
5 odpowiedzi
+ 5
When LHS is less than RHS then LHS is returned. In C++ modulo operator only works with integral operands, and since 3 % 5 doesn't even make 1 quotient, 3 was returned.
+ 2
If you try to divide 3 by 5 , you will get 3 as remainder and quotient will be 0.
+ 2
Ipang well explained answer
+ 2
Nitin Bisht % don't divide fully but rather stop at a less value or at a integer and then returns the extra value .
I should have included in my previous answer that i was talking in context of "%" not "/"
+ 1
Abhay if I am trying to divide 3 by 5 , I will get 0 as remainder and quotient will be 0.6