Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

palindrome program in c++

#include <iostream>


bool isPalindrome (int number) {
    int decomposed = number, reversed = 0;
    while (decomposed) {
        reversed = 10 * reversed + (decomposed % 10);
        decomposed /= 10;
    }
    return reversed == number;
}
 
PREVIOUS NEXT
Tagged: #palindrome #program
ADD COMMENT
Topic
Name
1+9 =