0
Anyone to speak to me? I still dont understand how to calculate the remmainder of a number
x%2. if two is the number which we gonna calcutate his multiple, 2 have an infinity interger multiples. what does this operator do exactly??
6 Answers
+ 1
is amazing how quickly i get the answers seconds latter i made the post
+ 1
very good community of people who just want to help
0
x % y returns the remainder of x / y.
x = 4, y = 2 would return 0 because 4 / 2 has no remainder.
x = 5, y = 2 would return 1 because 5 / 2 is 2 with a remainder of 1.
0
9%2 .. Remainder is 1
2-4-6-8 .. 1 remaining
14%3 .. Remainder is 2
3-6-9-12 .. 2 Remaining
Often used to differentiate odds and even.
If n%2==0 then n must be an even number.
If n%2!=0 then n must be an odd number.
0
Thank you all for clear my doubts