一个回文数指的是从左向右和从右向左读都一样的数字。最大的由两个两位数乘积构成的回文数是9009 = 91 * 99.
找出最大的有由个三位数乘积构成的回文数。
STDMETHODIMP COuLa::Test4(int iMaxNumber){ // TODO: 在此加入实现代码 int outputNumber = 0; int iMaxOutputNumber = 0; for(int i = iMaxNumber/10; i函数调用9) { iThirdNumber = iSecondNumber%10; iSecondNumber = iFirstNumber%10; iFirstNumber = iFirstNumber/10; } //printf("iFirstNumber is %d.\n", iFirstNumber); if(outputNumber%10 == iFirstNumber && (outputNumber/10%10) == iSecondNumber && (outputNumber/100%10) == iThirdNumber) { if(iMaxOutputNumber < outputNumber) iMaxOutputNumber = outputNumber; } } } printf("The Test 4 Number is %d.\n",iMaxOutputNumber); return S_OK;}
#define TEST4_NUMBER 1000IOula->Test4(TEST4_NUMBER);输出
The Test 4 Number is 906609.