天天看点

1272:三位数反转

1272:三位数反转

Description

输入一个三位数,求它反转后的三位数。

Input

一个三位数。

Output

反转后的三位数,要求忽略前导0。

Sample Input

120

Sample Output

21

HINT

题目要求忽略前导0.

Source

#include<iostream>
#include<string.h>
#include<stdio.h>
using namespace std;
int main()
{
    char ch[100];
    gets(ch);
    int n,i;
    n=strlen(ch);
    for(i=n-1;i>=0;i--)
    {
        if(ch[i]!='0')
          cout<<ch[i];
    }
 
   return 0;
 
}
           

继续阅读