News In A Snap!!

C++ Programs: Find the Largest Palindrome made from the Product of Two 3-digit Numbers

June 2, 2015

What is a Palindrome?

A word, phrase, or sequence that reads the same backwards as forwards, e.g. madam or nurses run.


/* Find the largest palindrome made from the product of two 3-digit numbers


#include <iostream.h>


int isPalindrome(int number);

int main() {


long largest = 0;

for (int i=999; i>0; i--)

for (int j=999; j>0; j--)


if (i*j > largest)

largest = i*j;

cout << "Largest palindrome is " << largest;


return 0;


int isPalindrome(int number) {

int original = number;

int reverse = 0;

for (int i=0; i<=number; i++) {

int remain = number%10;

number = number/10;

reverse = reverse*10 + remain;


return reverse == original;


palin | Get Tech Addicted...
About Us | Contact Us | ©2017