# BasilMarket # Replies

oh my bad, wasnt thinking of the other digits
Nov 18 2012
after about 30 mins... finished a program that gets the answer by the use of bruteforce (trial and error), nevertheless it outputs the answer. I'm sure there's a way with limits to find the answer..

#include <iostream>
#include <math.h>
using namespace std;
int main(){
int iNum1 =2, iNum2=1;
int iResult1, iResult2;
int iSqrt1, iSqrt2;
double dAns;
int aNum1;
int aNum2;
for(int c=0;c<=101;c++)
{
//cout <<"iNum2 = "<< iNum2;
//cout <<"tiNum1 = "<< iNum1 << endl;
if(iNum2==10)
{
iNum1++;
iNum2=0;
}
iResult1 = 0;
iResult2 = 0;
int aNum1={iNum1,iNum2};
int aNum2={iNum2,iNum1};
//concatenates the 2 digit number
iResult1 = ((aNum1)*10)+aNum1;
//cout << "iResult1= " << iResult1 << endl;
iResult2 = ((aNum2)*10)+aNum2;
// cout << "iResult2= " << iResult2 << endl;

if((iResult1 <= iResult2))
{
cout << "empty setn";
iNum2++;
}
else if(iResult2 <= 10)
{
cout << "empty setn";
iNum2++;
}else
{
iSqrt1 = (iResult1) * (iResult1);
iSqrt2 = (iResult2) * (iResult2);
dAns = iSqrt1 - iSqrt2;
cout << iResult1<< " - " <<iResult2<<" = " << sqrt(dAns) << endl;
iNum2++;
}
}
return 0;
}
[/quote]

btw the answer is 154... (65+56+33)
Nov 18 2012