This is due to the way you're incrementing the variables -
a
and
b
will always be either the same number, or consecutive numbers.
First iteration: (1, 1); (2, 1); (2, 2);
Second iteration: (2, 2); (3, 2); (3, 3);
...
Since the Pythagorean triplet which sums to 1000 doesn't involve consecutive numbers, your code will never find the answer. Since you haven't specified an upper bound for the loop, it will keep running forever.
Try a nested loop, and specify sensible upper-bounds. For example:
for (int a = 1; a < 1000; a++)
{
for (int b = a; b < 1000; b++)
{
...
}
}