c++的题目,求助!!

来源:百度知道 编辑:UC知道 时间:2024/07/03 07:14:52
将一个十进制整数按倒序输出,即输入156,输出651

请输入:
#include "stdio.h"
main()
{ int a,b,c,d,e,f;
scanf("%d",&a);
d=a/100;
e=(a-d*100)/10;
f=a-d*100-e*10;
printf("%d",(f*100+e*10+d));
}
具体对不对我不知道,我没试,你试一试吧!

#include <iostream.h>
void main()
{
int n,right_digit;
cout<<"enter the number:";
cin>>n;
cout<<"the number in reverse order is:";
do
{
right_digit=n%10;
cout<<right_digit;
n/=10;
}while(n!=0);
cout<<endl;
}
绝对是正确的