Title: An integer, which is a complete square after the number, plus 168 is a complete square number, what is the number?
Program analysis: In the judgment within the million, first of all, add the number after the prescription, and then add the number plus 268 after the root , if the result of the root to meet the following conditions , which is the result.
Program Source code:
#include <stdio.h>
#include <math.h>
int main ()
{
long int i, x, y;
for (i = 1; i<100000; i++)
{
x = sqrt (i + 100);
y = sqrt (i + 268);
if (x*x = = i + +) && (Y*y = = i + 268)/* * If the square root of a number equals that number, this indicates that the number is the total square number */
{
printf ("%ld\n", I);
}
}
System ("pause");
return 0;
}
Operation Result:
21st
261
1581
Please press any key to continue ...
This article is from the "Rock Owl" blog, please be sure to keep this source http://yaoyaolx.blog.51cto.com/10732111/1765892
Judged within 100,000, an integer plus 100 is a complete square number, plus 168 is a complete square number, which is calculated