floor division | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

floor division

why the result of -11//5 is -4 not -3

2nd Aug 2020, 10:01 PM
Asma Al-Samman
6 Answers
+ 4
It is definitely -3🙄
2nd Aug 2020, 10:06 PM
Abhay
Abhay - avatar
+ 2
Petr I don't think // exists in c
2nd Aug 2020, 10:22 PM
Abhay
Abhay - avatar
+ 1
Abhay sorry, I wanted to write -11//3 is -4 not -3
2nd Aug 2020, 10:28 PM
Asma Al-Samman
0
Asma Al-Samman In real mathematic the whole is the smallest of division. And the % is always the positive number. But in c and pascal it is wrong. It was the logics mistake from IBM. and in python -11//5 is -3, in c is -2
2nd Aug 2020, 10:06 PM
Petr
0
Abhay i try to describe the basis of problem and you are right. I corrected / .
2nd Aug 2020, 10:16 PM
Petr
0
Abhay yes, you're right again. but if we explain the semantics of another language when responding to the user regarding logic, then he may get confused in his thoughts :)) in c we will get the whole of division by another chars :)
2nd Aug 2020, 10:29 PM
Petr