将输入的数字进行逆序输出(运用do...while循环)
//逆序输出输入的整数 例如输入1234 输出4321
#include <stdio.h>
int main(){
int n,r;
scanf("%d",&n);
do{
r=n%10;
printf("%d",r);
n= n/10;
}while(n!=0);
return 0;
}
运行结果
将输入的数字进行逆序输出(运用do...while循环)
//逆序输出输入的整数 例如输入1234 输出4321
#include <stdio.h>
int main(){
int n,r;
scanf("%d",&n);
do{
r=n%10;
printf("%d",r);
n= n/10;
}while(n!=0);
return 0;
}
运行结果