+ 1
Hello! I made a programm in visual studio: ..... int a, b, s=0; a=7; b=5; s=a/b; cout<<s; cin.get(); return 0; when i run, programm show me 7/5=1, why not 1,4? please help
9 Answers
+ 5
...because you're doing int division. The result is an int.
+ 2
change all int to double that will work
+ 2
int/int returns int, cutting the value to int
+ 2
You need to use float or double.
+ 1
esti roman?đđ
+ 1
ca nu inteleg, eu asa am invatat la scoala, doar ca am lucrat in mingw
+ 1
not yet...
+ 1
ok
+ 1
double s