C语言基础:向左向右对其输出数字
#include <stdio.h>
int main ()
{
int int_value = 5;
float flt_value = 3.33;
printf("Right justified %5d value\n", int_value);
printf("Left justified %-5d value\n", int_value);
printf("Right justified %7.2f value\n", flt_value);
printf("Left justified %-7.2f value\n", flt_value);
return 1;
}
gcc编译运行输出
Right justified 5 value Left justified 5 value Right justified 3.33 value Left justified 3.33 value
