```
#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;
}
```

## Recommended Answers

Jump to Postline 22: use == operator, not the = assinment operator.

## All 2 Replies

Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster

SirMahlon
0
Junior Poster in Training

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.