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 b468aaf

Browse files
committed
Added palindrome number in C++
1 parent 7423d44 commit b468aaf

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include<bits/stdc++.h>
2+
using namespace std;
3+
bool palindrome(int x)
4+
{
5+
int n=x;//n acts as temporary variable for storing x
6+
int sum=0;//sum stores the inverted number
7+
while(n>0)
8+
{
9+
sum=sum*10+n%10;
10+
n/=10;
11+
}
12+
return sum==x?1:0;
13+
}
14+
int main()
15+
{
16+
cout<<palindrome(1991);
17+
}

0 commit comments

Comments
(0)

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