0

What if we just use // this operator and no % for any operation? Would it effect the calculation??

18th Jul 2016, 3:58 PM
Sourav Kumar
Sourav Kumar - avatar
3 Antworten
+ 2
it would not affect calculation if instead of a%b you used a-b*(a//b), but then you would have three operations instead of just one and it would look terribly ugly 7%2 = 1 7 - 2 * 3 = 1
18th Jul 2016, 6:53 PM
RedAnt
RedAnt - avatar
+ 1
// gives the quotient eg: 7//3 = 2 % gives the remainder eg: 7%3 = 1
20th Jul 2016, 7:16 PM
prudhvi theja
prudhvi theja - avatar
0
// is floor division. % is modulo. And exactly what prudhvi said is how they work.
28th Jul 2016, 10:39 PM
daniel fancher
daniel fancher - avatar