+ 1

I'm not understanding about "float" in C programming. And difference of between %d,%f .

29th Sep 2018, 6:56 AM
Anin Hasan
Anin Hasan - avatar
6 Answers
+ 4
float refer to data type used in C to store floating point numbers. The format parameter %d its used for treat relative parameter like an int, while %f like a float ex. printf("%d %f", 10, 50.65f);
29th Sep 2018, 7:01 AM
KrOW
KrOW - avatar
+ 2
but sometimes "%5.6f" what does it mean ?
29th Sep 2018, 7:04 AM
Anin Hasan
Anin Hasan - avatar
+ 2
It mean "print the floating number using least 5 digits and least 6 decimals" See here http://www.cplusplus.com/reference/cstdio/printf/
29th Sep 2018, 7:06 AM
KrOW
KrOW - avatar
+ 2
thank you 😄
29th Sep 2018, 7:11 AM
Anin Hasan
Anin Hasan - avatar
+ 2
👍👍👍
29th Sep 2018, 7:11 AM
KrOW
KrOW - avatar
+ 1
Okay.. by %d can i print any normal number? and %f is for point number. right?
29th Sep 2018, 7:03 AM
Anin Hasan
Anin Hasan - avatar