+ 1

Temporary float

What's the difference between these two codes written in c(what difference "(float)" is making) #include <stdio.h> int main() { int a=81, b=39, c,d,e; c=a+b; printf("Answer to the function (a+b) = %d\n",c); d=(float)a/b; printf("Answer to the function (a/b) = %d\n",d); e=a-b; printf("Answer to the function (a-b) = %d\n",e); return 0; } and this #include <stdio.h> int main() { int a=81, b=39, c,d,e; c=a+b; printf("Answer to the function (a+b) = %d\n",c); d=a/b; printf("Answer to the function (a/b) = %d\n",d); e=a-b; printf("Answer to the function (a-b) = %d\n",e); return 0; }

2nd Feb 2018, 5:54 PM
MOHIT MEHTA
MOHIT MEHTA - avatar
1 Resposta