关于C语言编程(在线等,简单)

来源:百度知道 编辑:UC知道 时间:2024/05/14 03:42:46
"从键盘上输入一个整数,分别输出它的个位数,十位数,百位数. 高手快点把答案发上来,要验证过能用的,我就给分,在线等

调试通过..
#include<stdio.h>
void main()
{
int i;
printf("Input a Number:");
scanf("%d",&i);
while(i)
{
printf(" %5d\n",i%10);
i/=10;
}
}

main(){
int a,b;
scanf("%d",&a);
while(a){
b=a%10;
printf("%d\n",b);
a=a/10;
}
}

算法可以这样:
整数n,
百位数a=n/100(取下限),
十位数b=n/10(取下限)-10a,
个位数c=n-100a-10b,

#include <stdio.h>
main()
{
int thenubmer;
int gewei;
int shiwei;
int baiwei;
scanf("%d",&thenumber);
if (thenumber>999 || thenumber<100)
{
printf("please input your number!");
}
else
{
baiwei=thenumber /(这个我忘了哪个是整除的了,自己查资料吧) 100;
gewei=thenumber % 10;
shiwei=thenumber % 100 / 10;
printf("gewei is %d,