
正确代码
#include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
int x=0;
for(int i=0;i<3;i++)
{
x=x*10+n%10;
n/=10;
}
printf("%d",x);
return 0;
}

#include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
int x;
while(n){
x = n%10;
if(x){
printf("%d",x);
}
n/=10;
}
return 0;
}

本文介绍了一种使用C语言实现的逆序输出整数的方法。通过两个不同的代码示例,展示了如何从一个整数中提取每一位数字并逆序打印出来。第一个示例使用for循环迭代三位数的每一位,而第二个示例则使用while循环处理任意长度的整数,直至所有位数都被处理完毕。
697

被折叠的 条评论
为什么被折叠?



