判断字符串是否为回文。若是则函数返回yes,否则返回no。
哈喽C!判断字符串是否为回文

//试用情景,处理大数字。使用字符串处理方式。因为回文数关于中心对称,只要比较对称的数即可。
#include<stdio.h>
#include<string.h>
int main()
{
    int i,length,flag=1;
    char a[100];
    gets(a);
    length=strlen(a);
    for(i=0;i<=length/2;i++) 
	{
       if(a[i]!=a[length-i-1])
	    {
           flag=0;
           break;
       }
    }
    if(flag==1)
      printf("yes");
    else
      printf("no");
    return 0;
}

相关文章:

  • 2021-11-15
  • 2021-11-04
  • 2021-12-04
  • 2021-12-04
  • 2021-11-04
  • 2021-11-04
  • 2021-08-07
  • 2021-08-30
猜你喜欢
  • 2021-04-12
  • 2021-10-08
  • 2021-12-04
  • 2021-12-14
  • 2021-11-04
  • 2021-12-04
相关资源
相似解决方案