We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents e8b0423 + a7a59bd commit 58f1cefCopy full SHA for 58f1cef
palindrome/palindrome.c
@@ -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 Palindromen", str);
17
+ return;
18
+ }
19
20
+ printf("%s is palindromen", str);
21
+}
22
23
+// Driver program to test above function
24
+int main()
25
26
+ char str[100];
27
+ scanf("%s",str);
28
+ isPalindrome(str);
29
+ return 0;
30
0 commit comments