怎们用for循环判断一个五位数的整数是否为回文数?

用C# 循环语句! C#
2025-03-20 21:29:53
推荐回答(1个)
回答1:

for(int i=0;i<10;i++)
{
string palindromeNumber=@"12321";
int ontChar=Convert.toint32(palindromeNumber.Substring(0,0));
int twoChar=Convert.toint32(palindromeNumber.Substring(1,0));
int threeChar=Convert.toint32(palindromeNumber.Substring(2,0));
int fourChar=Convert.toint32(palindromeNumber.Substring(3,0));
int fiveChar=Convert.toint32(palindromeNumber.Substring(4,0));

if(palindromeNumber.length==5)
if((ontChar==fiveChar)&&(twoChar&&fourChar))
return true;
}