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;
}