File tree 1 file changed +29
-4
lines changed
1 file changed +29
-4
lines changed Original file line number Diff line number Diff line change 1
1
#include < iostream>
2
2
3
3
using namespace std ;
4
+
5
+ void case1 (int x)
6
+ { x=121 ;
7
+ cout<<" for positive integers : " <<x<<endl;
8
+ }
9
+ void case2 (int x)
10
+ { x=-121 ;
11
+ cout<<" for negative integers : " <<x<<endl;
12
+ }
13
+ void case3 (int x)
14
+ { x=10 ;
15
+ cout<<" for integers end with zero: " <<x<<endl;
16
+ }
4
17
5
18
bool isPalindrome (int x) {
6
19
if (x < 0 )
@@ -22,12 +35,24 @@ using namespace std;
22
35
}
23
36
return false ;
24
37
}
38
+
25
39
int main ()
26
40
{
27
- int x=161 ;
28
- int c=isPalindrome (x);
41
+ int x,c,n;
42
+ case1 (x);
43
+ // cout<<isPalindrome(x);
44
+ if (c==0 )
45
+ {cout<<" false" <<endl;}
46
+ else {cout<<" true" <<endl;}
47
+ case2 (x);
48
+ c=isPalindrome (x);
49
+ if (c==0 )
50
+ {cout<<" false" <<endl;}
51
+ else {cout<<" true" <<endl;}
52
+ case3 (x);
53
+ c=isPalindrome (x);
29
54
if (c==0 )
30
- {cout<<" false" ;}
31
- else {cout<<" true" ;}
55
+ {cout<<" false" <<endl ;}
56
+ else {cout<<" true" <<endl ;}
32
57
return 0 ;
33
58
}
You can’t perform that action at this time.
0 commit comments