0

# But why it is 0 - 5 remainder in modulus. If I in calculator 8 divide 9 I get remainder 8. Please can someone explain me?

13th Jul 2018, 6:31 AM
Rytis Karalius
22 ответов
+ 1
Remainder is the part that gets left if you divide a number by another but care about only whole part in the answer. For example say the question is 9 % 10, 9 ÷ 10 equals 0.90 . we care only about the whole part and not the decimal so 0 becomes quotient and as 0 × 9 equals 0, The part that remain, 9 is the remainder in this case.
13th Jul 2018, 6:50 AM
Satyam
+ 3
Python 3 turns ints into floats during division i think.
13th Jul 2018, 7:08 AM
Satyam
+ 2
S. C. Thank you very much
13th Jul 2018, 6:55 AM
Rytis Karalius
+ 2
I was actually trying to show you how Modulo and division operator works
13th Jul 2018, 7:08 AM
Dlite
+ 1
no, remainder doesn't need to be from 0-5 only.
13th Jul 2018, 6:43 AM
Satyam
+ 1
Rytis Karalius 8 modulo 9 ========== Quotient = 0 Remainder = 8
13th Jul 2018, 6:45 AM
Dlite
+ 1
^^
13th Jul 2018, 6:46 AM
Satyam
+ 1
you need to declare float or double because 3.33333.. is real number ex float a=20/6 cout<<a the output is 3.33333
13th Jul 2018, 6:49 AM
LetterC67
+ 1
exactly what you should get. print(3.0 / 2) => 1.5 normal division as 2 × 1.5 = 3.0 print(3.0 // 2) => 1 floor division print(3.0 % 2) => 1 modulo as 1 × 2 + 1 = 3.0 in python 3
13th Jul 2018, 6:59 AM
Satyam
+ 1
Rytis Karalius Now try print(3/2)
13th Jul 2018, 7:03 AM
Dlite
+ 1
you will still get 1.5 if you do 3/2 .
13th Jul 2018, 7:04 AM
Satyam
+ 1
Thank you all for help : )
13th Jul 2018, 7:14 AM
Rytis Karalius
0
8 divide 9 remainder 8 is true can you explain more about your problem?
13th Jul 2018, 6:38 AM
LetterC67
0
🇻🇳GNAOH🇻🇳 So why when i use modulus operator the remainder os different?
13th Jul 2018, 6:39 AM
Rytis Karalius
0
🇻🇳GNAOH🇻🇳 Sorry the remainder is 8 but somebody said me that remainder only be from 0 -5 is this true
13th Jul 2018, 6:42 AM
Rytis Karalius
0
S. C. Can you explain me more about remainder?
13th Jul 2018, 6:44 AM
Rytis Karalius
0
20 % 6 is 2 but when I use this in calculator the remainder is 3. 20 / 6 is 3.3333
13th Jul 2018, 6:48 AM
Rytis Karalius
0
D'lite What I'm doing wrong?
13th Jul 2018, 6:48 AM
Rytis Karalius
0
Rytis Karalius Go to the Python Playground, and type this: print(3.0/2)
13th Jul 2018, 6:55 AM
Dlite
0
D'lite I got 1.5
13th Jul 2018, 6:58 AM
Rytis Karalius
Актуальное сегодня
super laggy