#include <iostream>
#include <ctime>
#include <cstdlib>
#include <iostream>

using namespace std;
For all 6-digit numbers from 100000 to 999999, find the numbers that, if you add the top three digits to the bottom three digits, and square the result, it will equal the original number.

For example, for 123456, you’d add 123 and 456, which equals 579. Then, square that sum, which yields 579 * 579 = 335241. 335241 ≠ 123456, so 123456 is not in the set
i need some help please.

int main()
{
    for ( int x =100000; x < 999999; x++)
                      {
        //cout<< x <<endl;
        int sum,result;
         int firstpart= x/1000;
         int secondpart =x%1000;
         sum = firstpart + secondpart;
         result=sum*sum;
         if (x=result)
         {
         cout<<result<<endl;
         }



  system("PAUSE");
            return 0;

}
This question has already been answered. Start a new discussion instead.