#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main() {
    double a, b, c;
    for (a = 1; a < 333; a++) {
        for (c = 335; c < 998; c++) {
            if ((sqrt(a) != (int) sqrt(a)) || (sqrt(c) != (int) sqrt(c))) continue;
            b = 1000 - c - a;
            if ((c * c) == (a * a) + (b * b)) break;
        }
    }
    printf("%.0lf + %.0lf + %.0lf = 1000\nProduct: %.0lf\n", a, b, c, a * b * c);
    system("pause");
    return 0;
}
I have this part of code whose purpose is to determine if variables a or c have natural square roots. Whenever I run the program I get that value of a and c are their max as written in the for loop, even though their square roots aren't whole numbers. When I assign sqrt(a) or sqrt(c) to different variable I get that for example when a = 332, sqrt(a) = 18.000000 when it should be 18.248288.
