+ 1

Can some one explain the operator % in C# ?

I dont understand how it functions ?

4th Jan 2019, 6:09 PM
Cesar Andres
Cesar Andres - avatar
3 odpowiedzi
+ 1
7 % 2 How often does the 2 fit whole into the 7? 3 times. And what's left after that? 7-2*3 == 1 7%2 == 1
4th Jan 2019, 6:18 PM
HonFu
HonFu - avatar
+ 1
You get the remainder of the division of operands. E. g. 11%3 = 2 because 11 = 3×3 + 2. Or 75%10=5 because 75 = 10×7 + 5
4th Jan 2019, 6:19 PM
Дмитро Іванов
Дмитро Іванов - avatar
+ 1
Thank you guys very much !!
4th Jan 2019, 6:49 PM
Cesar Andres
Cesar Andres - avatar