2024-10-14 08:27:50
需要准备的材料分别有:电脑、C语言
1、首先,打开C语言编译器,新建一个初始.cpp文件,例如:test.cpp。
2、在test.cpp文件中,输入C语言代码:。
int a = 100;
while(a != 0) {
int b = a % 10;
if (b > 0)
printf("%d", b);
a /= 10;
}
3、编译器运行test.cpp文件,此时成功将数进行了逆序输出,例如100输出了1。
2024-10-14 09:47:43
参考下面代码,r就是结果
int n,i,r;
r = 0;
scanf("%d", &n);
while (n !=0)
{
i = n %10;
r = r * 10 + i;
n = n /10;
}
printf("%d", r);
2024-10-14 08:18:35
若是101呢?
101倒过来还是101啊。
2024-10-14 09:03:43
2024-10-14 08:34:59