What is the difference between %d and %f in c programming?
In addition to Edwin's reply, if you use %d to print 5.26, you'll get an unexpected value. https://stackoverflow.com/questions/7480097/what-happens-to-a-float-variable-when-d-is-used-in-a-printf
To print a integer value we use %d like 5 For printing float value we use %f like 5.26
%d and %f are format specifiers. %d is used for integer(-3,-100,3,100,etc). And %f is used for float(10.6,-39.0,etc).
%i can also be used for integers.