+ 3

% <--

This symbol calculates to remainder ONLY of two #'s right? ex.) cout<<9%3; //output= 0 ! 3 cout<<7%2; //output= 5 ! 3 or am I doing this all wrong?

8th Feb 2018, 12:59 AM
HtagPro
HtagPro - avatar
2 ответов
+ 6
Yes remainder only. 9%2=1 7%4=3 1001%11=0
8th Feb 2018, 1:16 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 5
Well, almost. It basically just takes the remainder of the division of the numbers, but only for the order that they are set. For example, the equation 8%3 will only return 2 because 8/3 equals 2 which leaves a remainder of 2 (2•3=6, 8-6=2). It will not do this the other way around, so in the example it will not return 5.
8th Feb 2018, 1:19 AM
Faisal
Faisal - avatar