Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit de0de5c

Browse files
Create palindrome.cpp
1 parent 7d599e1 commit de0de5c

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
4+
5+
int rev(int n, int temp)
6+
{
7+
8+
if (n == 0)
9+
return temp;
10+
11+
// stores the reverse of a number
12+
temp = (temp * 10) + (n % 10);
13+
return rev(n / 10, temp);
14+
}
15+
16+
17+
int main()
18+
{
19+
20+
cout<<"Enter the Number= ";
21+
cin>>n;
22+
int temp = rev(n, 0);
23+
if (temp == n)
24+
cout << "yes" << endl;
25+
else
26+
cout << "no" << endl;
27+
return 0;
28+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /