+ 1

Pls guys i need help here, why didn't it also give my answer to the quotient?

https://code.sololearn.com/c5Fbwh0ptKSr/?ref=app

19th Jun 2019, 12:20 PM
Jeffkama
4 ответов
+ 1
Both a and b are integers. In this case a/b is an integer division, and it is between 0 and 1 so it is truncated to 0. If you want to do a floating point division then at least one of the operands must be a float. You can do implicit conversion to float like this: quo = (float)a/b;
19th Jun 2019, 12:30 PM
Tibor Santa
Tibor Santa - avatar
+ 1
It's because both numbers are integers, so it also returns an integer. You should change one of the to float or double
19th Jun 2019, 12:29 PM
Airree
Airree - avatar
+ 1
Thanks alot guys its working fine now 😊
19th Jun 2019, 12:42 PM
Jeffkama
0
So it would have been preferable to declear both a float
19th Jun 2019, 12:32 PM
Jeffkama