More output format with printf : Formatted Output Float « Console « C / ANSI-C






More output format with printf


#include <stdio.h>

int main(void)
{
  printf("%.4f\n", 123.1234567);
  printf("%3.8d\n", 1000);
  printf("%10.15s\n", "This is a simple test.");

  return 0;
}

  

           
       








Related examples in the same category

1.Outputting floating-point valuesOutputting floating-point values
2.Output float with format: round
3.Printf with format
4.Use printf to control the output format