Skip to content

Commit 1d42089

Browse files
committed
find whether number is palindrome or not c-basics
1 parent c5a2fa4 commit 1d42089

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

palindrome.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include<stdio.h>
2+
void main()
3+
{
4+
int i,n,r,rev=0,x;
5+
printf("Enter the number");
6+
scanf("%d",&n);
7+
x=n;
8+
while(n!=0)
9+
{
10+
r=n%10;
11+
rev=rev*10+r;
12+
n=n/10;
13+
}
14+
printf("%d\n",rev);
15+
16+
if(x==rev)
17+
{
18+
printf("It is palindrome");
19+
}
20+
else
21+
{
22+
printf("it is not palindrome");
23+
}
24+
}

0 commit comments

Comments
 (0)