+ 3
What is \\
someone please tell me what is \\ . And an exemple like.. 20 \\ 4 = ?
5 Antworten
+ 6
A small note to keep in mind: 10//3 = 3, but -10//3 = -4.
The // operator is suggestively called the floor division operator. It produces the biggest integer smaller than the result of the division.
In the second example above, -10/3 = -3.3333..., and -4 is the integer closest to -3.333... but smaller than it.
+ 4
It's //, not \\.
a // b is integer division. It tells you how many times a can be divided by b without a rest. 20 // 4 = 5 (because 5*4=20), 18 // 4 = 4 (because 4*4=16, so there is a rest of 2).
+ 3
\ gives exact value of divide.
9\2=4.5
but \\ use for floor division.
9\\2
--------
2| 9 |4
--------
8
--------
1
answer is 4 and here remainder is 1 which can find like this.
9%2=1
+ 2
so... 10//3 = 3 because 3*3 = 9 ... the closest number?
+ 2
Exactly. You can just calculate a/b and drop the decimals if there are any. 10/3 = 3.333333 => get rid of .333333 => 10//3 = 3 (always round down to the next integer)