用c语言编程:输入一个四位数,求出它的个位、十位、百位、千位
6个回答
展开全部
#include<stdio.h>
main()
{
int num,ge,shi,bai,qian;
printf("Input the num:\n");
scanf("%d",&num);
qian=num/1000;
bai=(num-1000*qian)/100;
shi=(num-1000*qian-100*bai)/10;
ge=num%10;
printf("\nge=%d, shi=%d, bai=%d, qian=%d",ge,shi,bai,qian);
}
main()
{
int num,ge,shi,bai,qian;
printf("Input the num:\n");
scanf("%d",&num);
qian=num/1000;
bai=(num-1000*qian)/100;
shi=(num-1000*qian-100*bai)/10;
ge=num%10;
printf("\nge=%d, shi=%d, bai=%d, qian=%d",ge,shi,bai,qian);
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询