#include
int main()
{
int a,b,c,d;
printf("The original number is :");
scanf("%d%d%d%d",a,b,c,d);
a=(a+9)%10;
b=(b+9)%10;
c=(c+9)%10;
d=(d+9)%10;
printf("The encrypted number is %d%d%d%d\n",c,d,a,b);
return 0;
}

为什么scanf输入之后的printf无法输出?
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
2条回答 默认 最新
- zhuanshulz 2020-10-18 10:11关注
因为你需要输入四个数字,而不是1234这一个数字。
#include"stdio.h" int main() { int a,b,c,d; printf("The original number is :"); scanf("%d%d%d%d",&a,&b,&c,&d); a=(a+9)%10; b=(b+9)%10; c=(c+9)%10; d=(d+9)%10; printf("The encrypted number is %d%d%d%d\n",c,d,a,b); return 0; }
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决评论 打赏 举报无用 4