fork download
  1. #include <stdio.h>
  2. int main(){
  3. float a=1.234;
  4. int b=10;
  5. printf("%.2f\n", a);
  6. printf("%5.1f\n", a);
  7. printf("%05.1f\n",a);
  8. printf("%-05.1f\n",a);
  9. printf("%5d\n", b);
  10. printf("%05d\n", b);
  11. printf("%-5d\n", b);
  12. printf("%-05d\n", b);
  13. return 0;
  14. }
  15.  
Success #stdin #stdout 0s 5288KB
stdin
Standard input is empty
stdout
1.23
  1.2
001.2
1.2  
   10
00010
10   
10