-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpallindrom_number.cpp
More file actions
66 lines (47 loc) · 890 Bytes
/
pallindrom_number.cpp
File metadata and controls
66 lines (47 loc) · 890 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include<iostream>
using namespace std;
void pallindrom(int n)
{
int temp=n;
int rev=0,r;
while(temp!=0)
{
r=temp%10;
rev=rev*10+r;
temp=temp/10;
}
if(rev==n)
{
cout<<"\n Number is pallindrom.";
}
else
{
cout<<"\n Number is not pallindrom.";
}
}
int main()
{
int n;
cout<<"\n Pallindrom Number\n";
cout<<"\n Enter the number : ";
cin>>n;
pallindrom(n);
cout<<"\n";
return 0;
}
/* Output
(base) mansi@mansi-Vostro-15-3568:~$ g++ pallindrom_number.cpp
(base) mansi@mansi-Vostro-15-3568:~$ ./a.out
Pallindrom Number
Enter the number : 12344321
Number is pallindrom.
(base) mansi@mansi-Vostro-15-3568:~$ ./a.out
Pallindrom Number
Enter the number : 12543
Number is not pallindrom.
(base) mansi@mansi-Vostro-15-3568:~$ ./a.out
Pallindrom Number
Enter the number : 1234321
Number is pallindrom.
(base) mansi@mansi-Vostro-15-3568:~$
*/