/*
判断是否为对称数,(0~10不属于)将输入整数反转后,再与原来的数对比
*/
#include <iostream>
#include <math.h>
#include <stdlib.h>
#include <string.h> //别漏
#include <string> //别漏
#include <algorithm> //transform函数来自这里
#include <stdio.h>
using namespace std;
int main()
{
while(1)
{
int n;
cin>>n;
if(n<=10)
{
cout<<"no"<<endl;
}
else //反转处理
{
int n1=n;
int n2=0;
int flag=0;
while(n!=0)
{
if(flag==1) n2*=10; //进位操作,首次不进位
flag=1;
n2+=n%10;
n/=10;
}
if(n1==n2) cout<<"yes"<<endl;
else cout<<"no"<<endl;
}
}
}
判断对称整数
猜你喜欢
转载自blog.csdn.net/Galahad_LLLLLL/article/details/88775899
今日推荐
周排行