float a=3,b=2; printf("%d",a/b); printf("%f",a/b); | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

float a=3,b=2; printf("%d",a/b); printf("%f",a/b);

where my answer gets stored and why i get garbage for %d

3rd Aug 2017, 1:01 PM
Ayush Singh
Ayush Singh - avatar
1 Answer
0
because a/d is not converted to int and float and int numbers are not represented the same way in a binary scale do : printf("%d ",(int)(a/b));
4th Aug 2017, 9:50 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar