- 2

String Palindrome in C..

Does anybody knows how to check palindrome for string in C language using for loop

19th May 2022, 1:38 PM
AJAS
AJAS - avatar
2 Answers
+ 1
Ajas Mohammed post your try? reverse of string is equal to original string then it is polindrome. using a loop, check chat array i= first character 0th, with last character (j = length-1), if same continue to repeat this until not same or until i < j.
19th May 2022, 1:42 PM
Jayakrishna 🇼🇳
+ 1
bool isPalindrome(int x) { int temp = x, reverse = 0; while (temp != 0) { reverse = reverse * 10; reverse = reverse + temp % 10; temp = temp / 10; } if (x == reverse) return 1; else return 0; }
21st May 2022, 5:37 PM
Ulysses Apokin
Ulysses Apokin - avatar