Print
Print with specific format
#include <stdio.h>

/* line 1
 * line 2
 */
int main () {

	float pi = 3.1415926;

  	printf("%10s: %10.2f\n", "PI", pi);
  	printf("%-10s: %10.2f\n", "PI", pi);
  	printf("%10s: %010.2f\n", "PI", pi);

   	return 0;
}
			
Knowledge Points
  • %a.bf
  • %c, character
  • %d, integer
  • %f, float
  • %e, scientific notation
  • %s, string
  • -, left alignment
  • Reference
  • printf