+ 2

palindrome practice lesson

it keep expecting while before my if statement https://code.sololearn.com/cT1OVXLDcds8/?ref=app

22nd Sep 2021, 2:46 PM
The gun whose owner used to kill Abraham Lincoln
The gun whose owner used to kill Abraham Lincoln - avatar
6 Answers
+ 6
here is also a version using string to check for palindrome: https://code.sololearn.com/cahk28iWx220/?ref=app
24th Sep 2021, 12:22 PM
Lothar
Lothar - avatar
+ 4
The error is due to missing semicolon(;) after "return true" But there is logic error too, I have made some changes, kindly do a bit of analysis and implement it Then your code will give desirable output. bool isPalindrome(int x) { //complete the function int digit,z, rev=0; z=x; while (z > 0) { digit = z % 10; rev = rev*10 + digit; z /= 10; } if (x == rev) return true; else return false; } here is the edited code!!!! The gun whose owner used to kill Abraham Lincoln https://code.sololearn.com/cuB7pL1I5w9D/?ref=app
22nd Sep 2021, 3:43 PM
Saurabh
Saurabh - avatar
+ 2
The thing is i dont know those method xF. Well i know that those function exist since i am familiar with other code language as well but i thought that u have to import those or something. still a newbie to c++
24th Sep 2021, 6:02 PM
The gun whose owner used to kill Abraham Lincoln
The gun whose owner used to kill Abraham Lincoln - avatar
+ 1
Use semicolons if (x == rev) return true; else return false;
22nd Sep 2021, 3:14 PM
Pariket Thakur
Pariket Thakur - avatar
+ 1
bless y all
22nd Sep 2021, 4:07 PM
The gun whose owner used to kill Abraham Lincoln
The gun whose owner used to kill Abraham Lincoln - avatar
+ 1
i have consider using string variable but dont know how to reverse äč[ ◕ ᎄ ◕ ]ㄏ
24th Sep 2021, 6:03 PM
The gun whose owner used to kill Abraham Lincoln
The gun whose owner used to kill Abraham Lincoln - avatar