代码如下
/*
从键盘连续输入一串数字“123456789”,要求用scanf函数(提示:利用“域宽”和“*” )输出a=12,b=567,c=9
*/
#include<stdio.h>
#include"stdlib.h"
int main()
{
int a,b,c;
printf("enter the number :\n");
scanf("%2d%2d%3d%1d%1d",&a,&b,&b,&c,&c);
rewind(stdin);
printf("a=%d,b=%d,c=%d\n",a,b,c);
system("pause");
return 0;
}
其中rewind(stdin);和system("pause");这两句是为了更好展示 非必要可以删除
温馨提示:答案为网友推荐,仅供参考