-
#include<stdio.h> int main(){ int a=123,b=456; char c; //float c=123.456; //scanf("%3d",&b); //printf("%d",b); //scanf("%5.5f",&c);//不合法,无法输入 //scanf("%d%d",&a,&b); //printf("%d%d",a,b); //scanf("%d%c",&a,&c); //printf("%d%c\n",a,c); scanf("%d,%c",&a,&c); printf("%d%c\n",a,c); //int i; //printf("%d%d\\\n",a,b); //printf("%%"); //printf("%8d%6d\n",a,b); //printf("%-8d%6d\n",a,b);//“-”左对齐将空格移至右边 //printf("%08d%06d\n",a,b); //printf("%*d%6d\n",i,a,b); /*for(i=3;i<=8;i++){ printf("%*d%6d\n",i,a,b);//i=?,"?"是小数位数 }*/ //printf("%4.2f",c);//浮点数位数不足时,将相应小数位四舍五入后输出 return 0; }
2.如果运行结果要显示\,%,需打\\,%%
3.