We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c5c05c2 commit ea27787Copy full SHA for ea27787
palindrome
@@ -0,0 +1,30 @@
1
+#include <stdio.h>
2
+#include <string.h>
3
+
4
+// A function to check if a string str is palindrome
5
+void isPalindrome(char str[])
6
+{
7
+ // Start from leftmost and rightmost corners of str
8
+ int l = 0;
9
+ int h = strlen(str) - 1;
10
11
+ // Keep comparing characters while they are same
12
+ while (h > l)
13
+ {
14
+ if (str[l++] != str[h--])
15
16
+ printf("%s is Not Palindrome", str);
17
+ return;
18
+ }
19
20
+ printf("%s is palindrome", str);
21
+}
22
23
+// Driver program to test above function
24
+int main()
25
26
+ isPalindrome("abba");
27
+ isPalindrome("abbccbba");
28
+ isPalindrome("geeks");
29
+ return 0;
30
0 commit comments