输入一个整数N,逆序输出N的各位数,如果输出的起始是0,则不输出,从非0位开始输出。

python 啊 求 python大佬 厉害的加个企鹅

#include "stdio.h"
int main(int argv,char *argc[]){
int n;
printf("Input an integer(int n>=0)...\nn=");
if(scanf("%d",&n)!=1 || n<0){
printf("Input error, exit...\n");
return 0;
}
while(n%10==0)
n/=10;
while(n){
printf("%d",n%10);
n/=10;
}
printf("\n");
return 0; 
}

运行样例“

追问

大佬直接教我怎么把这个单引号去掉吧

追答

你在追问什么?运行结果不是有“黑框框”佐证吗?

追问

大佬python你强不强 可否加个qq

追答

不好意思,我写的是C,我不会python。刚没有看题目要求用python写。不好意思,就算是打扰你了!

温馨提示:答案为网友推荐,仅供参考
第1个回答  2017-12-29
#include <stdio.h>
int main()
{
    int a, t;
    scanf ("%d", &a);
    t = 0;
    while (a){
        t= t*10+a%10;
        a/=10;
    }
    printf("%d\n", t);
    getch();
    
    return 0;
}

追问

什么鬼

追答# -*- coding:utf-8 -*-
x=raw_input('Please input a number:\r\n')
print ''.join([''.join(i) for i in x[::-1] if i!='0'])
 
>>>
Please input a number:
123
321