Palindrome numbers | SoloLearn: Learn to code for FREE!

0

Palindrome numbers

#include <iostream> using namespace std; bool isPalindrome(int x) { //complete the function } int main() { int n; cin >>n; if(isPalindrome(n)) { cout <<n<<" is a palindrome"; } else { cout << n<<" is NOT a palindrome"; } return 0; }

1/16/2021 8:54:01 AM

PARUCHURI YASWANTH

12 Answers

New Answer

+4

PARUCHURI YASWANTH Check this and compare with your code https://code.sololearn.com/cewmk9Y1QUql/?ref=app

+2

PARUCHURI YASWANTH Show your attempts.

+2

PARUCHURI YASWANTH And don't make different thread for same question. https://www.sololearn.com/Discuss/2667495/?ref=app

+2

PARUCHURI YASWANTH Share your complete code.

+2

PARUCHURI YASWANTH I told you method should return true if original and reverse values are equal so where is this part in your code?

+1

PARUCHURI YASWANTH And check if original input and reverse input are equal then return true.

+1

Thank you so much sir It works 😊

0

do { digit = num % 10; rev = (rev * 10) + digit; num = num / 10; } while (num != 0);

-1

It's not working

-1

#include <iostream> using namespace std; bool isPalindrome(int x) { //complete the function int n,s=0,r; x=n; while(n!=0) { r=n%10; s=s*10+r; n=n/10; } } int main() { int n; cin >>n; if(isPalindrome(n)) { cout <<n<<" is a palindrome"; } else { cout << n<<" is NOT a palindrome"; } return 0; }

-1

Actual output is 8888 is a palindrome

-1

Iam trying a lot But it won't works sir