fork download
  1. #include <stdio.h>
  2. int main()
  3. {
  4. int n=123;
  5. printf("%05d\n",n);
  6. //05 indicated padding total width of output must be 5
  7. //if it's less than 5 then output will pad with 0's
  8.  
  9. float f=3.45;
  10. printf("%08.2f",f);
  11. //Same case applies here in which total width is 8
  12. //(.2 indicates width after radix point)
  13.  
  14. return 0;
  15. }
Success #stdin #stdout 0s 10320KB
stdin
Standard input is empty
stdout
00123
00003.45