Temporary float | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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
0 Answers