0

Division

Doing an exercise I was asked to answer Print((4+8)/2) The answer was not 6 The answer was 6.0 Could someone please explain why?

18th Aug 2020, 11:31 AM
Shy
1 Odpowiedź
+ 2
When arithmetic expression uses floor division ("/") it returns a floating point value. If you want to return an integer value you have to use integer division("//") instead of floor division("/").
3rd Dec 2020, 3:11 PM
Yasara hasini