Computer Science, asked by thiyanemohan, 8 months ago

The given code is supposed to check whether the given number is palindrome or not. Due to some logical errors or syntax errors, it fails to print the desired result. Fix the code to pass the test case.



Palindrome number is the number which remains the same even after reversing the digits in it.



Sample Input:

414

Sample Output:

Palindrome

Answers

Answered by Pranjal129
0

Answer:

apply rem before the command

Answered by kanaramyadavofficial
1

Answer:

#include <iostream>

int main()  

{

int n, rev = 0, temp;

  std::cin>>n;

  temp=n;

  while(n > 0){

           int r = n % 10;

           rev = rev * 10 + r;

           n = n / 10;

      }

      if(rev == temp)

      std::cout<<"Palindrome";

return 0;

}

Explanation:

Similar questions