Skip to content

Commit 9e6cd3b

Browse files
authored
Update Palindromeofnumber.cpp
1 parent 227dcf0 commit 9e6cd3b

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

Palindromeofnumber.cpp

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
1-
#include<bits/stdc++.h>
1+
#include <iostream>
2+
#include <algorithm>
3+
24
using namespace std;
35

46
int main()
57
{
6-
int num;
7-
cin>>num;
8+
int num;
9+
cout << "Enter number = ";
10+
cin >> num;
811

9-
string s1 = to_string(num);
10-
string s2 = s1;
12+
string s1 = to_string(num);
13+
string s2 = s1;
1114

12-
reverse(s1.begin(),s1.end());
15+
reverse(s1.begin(),s1.end());
1316

14-
if(s1==s2)
15-
cout<<"true";
16-
else
17-
cout<<"false";
17+
if(s1 == s2)
18+
cout<<"true";
19+
else
20+
cout<<"false";
1821

19-
return 0;
22+
return 0;
2023
}

0 commit comments

Comments
 (0)