判断是否回文

来源:互联网 发布:中世纪2 优化9 波兰 编辑:程序博客网 时间:2024/05/04 01:32

#include<stdio.h>
#include<string.h>

int main(){

        int lenth,i;
        char str[]={};
        printf("please input the string:");
        scanf("%s",str);
        lenth=strlen(str);
        while(i<=lenth/2){
        if(str[i]==str[lenth-i-1]){
                i++;
                continue;
        }
        else
                break;
        }
        if(i>lenth/2){
                printf("yes\n");
        }
        else
                printf("no\n");
        return 0;
0 0