+ 1

How to get output in decimals in division

24th Dec 2017, 4:29 AM
Rahulpreetham
Rahulpreetham - avatar
2 ответов
+ 19
Use float data type or double for your variable float a , b, c; c= a/b;
24th Dec 2017, 4:47 AM
Frost
Frost - avatar
+ 3
Or type cast them: int x=3, y=4; float quot=float(x)/float(y); cout << quot;
24th Dec 2017, 8:00 AM
Jared
Jared - avatar