Meaning of .2f | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Meaning of .2f

C language

25th Dec 2018, 10:45 AM
KARTHIK TELU
KARTHIK TELU - avatar
3 Answers
+ 2
If you add %.2f in scanf then output will show 2 digit after decimal! If you add %.nf in scanf then output will show n digits after the decimal.
25th Dec 2018, 11:12 AM
AL Araf
AL Araf - avatar
+ 4
KARTHIK TELU It's just a limit Example : Your output with %f is 2.333333 When you use %.2f the output will be like 2.33
25th Dec 2018, 10:57 AM
deeyae
deeyae - avatar
+ 1
It also mean 0.2 in float float x = .2f;
25th Dec 2018, 11:10 AM
Taste
Taste - avatar