0

Can anyone help me here😑 im a begginer

A palindromic number is a number (such as 626) that remains the same when its digits are reversed. Write a function that returns true if a given number is a palindrome, and false, if it is not. Complete the given function, so that the code in main works and results in the expected output. Sample Input: 13431 Sample Output: 13431 is a palindrome

21st Jan 2021, 2:59 AM
Janiera Raniola
Janiera Raniola - avatar
3 Answers
+ 1
-make a copy of "input" -reverse it -compare with original
21st Jan 2021, 6:05 AM
Michal Doruch
+ 1
#include <iostream> using namespace std; int main() { int n, num, digit, rev = 0; cin >> num; n = num; do { digit = num % 10; rev = (rev * 10) + digit; num = num / 10; } while (num != 0); if (n == rev) cout <<n<< " is a palindrome"<<endl; else cout <<n<< " is NOT a palindrome"<<endl; return 0;
24th Jan 2021, 1:29 PM
Nirali Ziba
Nirali Ziba - avatar
0
Question is pretty simple once Search on Google you can find easily
21st Jan 2021, 3:35 AM
A S Raghuvanshi
A S Raghuvanshi - avatar