Formatted output: int, float and string : Formatted Output Int « Console « C / ANSI-C






Formatted output: int, float and string

  
#include <stdio.h>

int main(void)
{
  printf("%.5d\n", 10);
  printf("$%.2f\n", 99.95);
  printf("%.10s", "This is a long line\n");

  return 0;
}


           
       








Related examples in the same category

1.Integer output variations
2.Variations on a single integerVariations on a single integer
3.Output justifyOutput justify
4. Print formatted data to stdout: how to use printf Print formatted data to stdout: how to use printf
5.Output formatted ramdom integerOutput formatted ramdom integer