+ 3
[There's not] an Error in tutorial question!
What is the output of this code? a = 25 b = 8 x = a/b puts x+b Value a should be 24. the answer is 11 . Just saying!! :)
8 odpowiedzi
+ 8
You're dealing with an integer, or whole number, so there's no decimal points, which is why the equation (X = 25 ÷ 8) works.
25 ÷ 8 = 3.125, but since no decimals are allowed, it becomes 3.
Now it's X+B, and X = 3, and B = 8
So X+B is 3 + 8 which equals 11.
+ 10
no, it is ok, these numbers are integers so 25 / 8 is also 3 like 24 / 3 is 3...
+ 3
its no error buddy . its simple division ( the one we did in lower classes without any decimal ).
but its good that u clarified it. 😀😀😀
+ 2
25/8=3.125
I assume that you are using int so the .125 is ‘thrown’ away. And 3 + 8 = 11
+ 2
Oh god.
Good to clear that up- we're dealing with integers.... OK then (rewind!!!) :)
+ 1
Oh I see what happend. You did the division but multiplied instead of adding the 8.
0
I ask...why you use 24 in this code