# Palindromic numbers C++

Hi, I am attempting to solve a problem of finding the largest palindromic number which is a product of two 3-digit integers. I tried a rather straightforward approach yet there is no output. Any advice? Here is the code: https://code.sololearn.com/cLjb5EQxlF79

8/19/2017 11:42:52 PM

Tauras4 Answers

New Answerheighest palindrom satisfying your condition is ----> 906609 ( 993 * 913) check it https://code.sololearn.com/c9Nr2Y7d5rgS/?ref=app

Cheers. Loving the elegance of python there (and the solution, obviously). Yeah, I noticed it was a wrong assumption, so I added another loop. Still, something does not work. I think the problem lies in the if loops but not sure. int main(){ int palindrome = 0; int first = 999; int second = 999; int arr[6] = {0}; while(first>99){ while(second>99){ palindrome=first*second; for(int i=5; i>=0; i--){ arr[i] = palindrome%10; palindrome /=10; } if(arr[0] == arr[5]){ if(arr[1] == arr[4]){ if(arr[2] == arr[3]){ for (int y=0; y<6; y++){ cout<<arr[y];} return 0; } } } second--; } first--; } }

BROTHER PALINDROME NUMBERS ARE LIKE THIS--> 121 135686531 9990000999 89098 98789 10101 HOW CAN YOU ASSUME A MULTIPLE AS 999 THERE IS ACTUALLY NO NUMBER THAT IS A MULTIPLIED VALUE OF 2 THREE DIGIT NUMBER WHERE ONE DIGIT IS 999 YOU CANT ASSUME THAT.. AS U ARE ASSUMING IT IS GIVING THE TRUE OUT PUT.. AS THERE IS NO SUCH NUMBER SO "" NO OUTPUT""..