회귀
-
문자 - 펠린드롬(Palindrome) 인지 확인 하기기본(Basic) 2021. 1. 6. 12:47
include #include // A function to check if a string str is palindrome void isPalindrome(char str[]) { // Start from leftmost and rightmost corners of str int l = 0; int h = strlen(str) - 1; // Keep comparing characters while they are same while (h > l) { if (str[l++] != str[h--]) { printf("%s is Not Palindrome", str); return; } } printf("%s is palindrome", str); } // Driver program to test above..