0
Why 0 gets added in the beginning here?
https://code.sololearn.com/ckrXguAg4G14/?ref=app Why three 0s are getting added in the beginning when I give the format as %2.4d ?
4 Answers
+ 2
We mostly using this when we dealing with floating values . If we want to print digits upto which we want.
Here %2.4 2 won't effect your program u can also write %.4 instead of 2.4 it will print number upto four digits here u used single digit number so 3 zero will added automatically
printf("%2.4d",a);
+ 2
Yeah same try with float u will understood better
0
A.S. so this gets added by default when I use int right?
0
A.S. sure thanks!