0

Can you tell me why are they saying to try again after completion of this code, is there any mistake?

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

7th Aug 2022, 2:13 PM
Hafiz Muhammad Zubair
Hafiz Muhammad Zubair - avatar
2 Answers
+ 1
What is the code you added to complete this task? x is integer. And it is passed value which you just returning same..!! You need to return true or false...
7th Aug 2022, 2:17 PM
Jayakrishna🇮🇳
Jayakrishna🇮🇳 - avatar
+ 1
There is a function (ispalindrome) in which you need write the logic to check the number is palindrome or not. and return the result. result can be in the boolean form Palindrome number are those numbers which are equal after reversing them.
7th Aug 2022, 5:53 PM
Pallavi Jha
Pallavi Jha - avatar