Skip to content
This repository was archived by the owner on Jun 26, 2022. It is now read-only.

Commit d9a9996

Browse files
authored
sejalshri_palindrome.cpp #1
1 parent cd0b78c commit d9a9996

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

cpp/sejalshri_palindrome.cpp

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#include <iostream>
2+
#include <bits/stdc++.h>
3+
using namespace std;
4+
void myfunction();
5+
int main() {
6+
int n,count=0,rev=0,i,t;
7+
8+
//take number from user
9+
cin>>n;
10+
t=n;
11+
12+
//to count digits of a number
13+
count=(int)log10(n);
14+
15+
//to find reverse of a number
16+
while(t!=0)
17+
{
18+
i=t%10;
19+
rev=rev+(i* pow(10,count));
20+
t=t/10;
21+
count--;
22+
}
23+
24+
//check whether it is palindrome or not
25+
if(rev==n)
26+
{
27+
cout<<"given number is a palindrome number";
28+
}
29+
else
30+
cout<<"given number is not a palindrome number";
31+
}
32+
33+
/* sample input-output
34+
454
35+
given number is palindrome number*/

0 commit comments

Comments
 (0)