C013:颠倒显示三位数

代码:

#include "stdafx.h"

int _tmain(int argc, _TCHAR* argv[])
{
    int original;

    do{
        printf("Enter a three-digit number:");
        scanf("%d",&original);

        int handred=original/100;
        int ten=(original-100*handred)/10;
        int ge=original%10;

        printf("The reversal is %d%d%d\n",ge,ten,handred);
    }while(original!=999);

    return 0;
}

输出:

Enter a three-digit number:123
The reversal is 321
Enter a three-digit number:456
The reversal is 654
Enter a three-digit number:987
The reversal is 789
Enter a three-digit number:357
The reversal is 753
Enter a three-digit number:179
The reversal is 971

--2020年6月10日--

posted @ 2020-06-10 09:45  逆火狂飙  阅读(249)  评论(0编辑  收藏  举报
生当作人杰 死亦为鬼雄 至今思项羽 不肯过江东