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.
1 parent c9fb36e commit 6daec1eCopy full SHA for 6daec1e
c/palindrome.c
@@ -0,0 +1,40 @@
1
+#include <stdio.h>
2
+#include <conio.h>
3
+int reverse(int num);
4
+int p_d(int num);
5
+int main()
6
+{
7
+ int num;
8
+ printf("Number:");
9
+ scanf("%d", &num);
10
+ if(p_d(num) == 1)
11
+ {
12
+ printf("Palindrome");
13
+ }
14
+ else
15
16
+ printf("Not Palindrome");
17
18
+ return 0;
19
+}
20
+int p_d(int num)
21
22
+ if(num == reverse(num))
23
24
+ return 1;
25
26
27
28
+int reverse(int num)
29
30
+ int rem;
31
+ static int sum=0;
32
+ if(num!=0){
33
+ rem=num%10;
34
+ sum=sum*10+rem;
35
+ reverse(num/10);
36
37
38
+ return sum;
39
40
0 commit comments