2018软工第五题

编程判断某数字是否为回文数。

#include <stdio.h>
#include <string.h>
const int maxn = 100;
bool Judge(char str[], int n)
{
	for(int i =0 ; i < n / 2; i++)
	{
		if(str[i] != str[n - i - 1])
		{
			return false;
		}
	}
	return true;
}
int main(void)
{
	char str[maxn];
	scanf("%s", str);
	int len = strlen(str);
	if(Judge(str, len))
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}

	return 0;
}

猜你喜欢

转载自blog.csdn.net/qq_41667538/article/details/88413840