Skip to content

Commit 952adc4

Browse files
author
Neha Kumari
committed
palindrome
1 parent 5613d10 commit 952adc4

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

palindrome.cpp.txt

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include<iostream>
2+
using namespace std;
3+
int main()
4+
{
5+
int n,num,d,rev=0;
6+
cout << "enter the positive number";
7+
cin >> num;
8+
n=num;
9+
do
10+
{
11+
d=num%10;
12+
rev=(rev*10)+d;
13+
num=num/10;
14+
}
15+
while(num!=0);
16+
cout << "the reverse of the number is:"<< rev << end1;
17+
if(n==rev)
18+
cout << "the number is palindrome";
19+
else
20+
cout << "the number is not palindrome";
21+
return 0;
22+
}

0 commit comments

Comments
 (0)