今天在码代码时发现pow()和基本的变量乘法似乎有出入。
代码:
#include <stdio.h>
#include <math.h>
int main(int argc, char const *argv[])
{
int t = 0, flag = 0;
int m = -39, n = 40;
for (int i = m; i <= n; ++i)
{
printf("%d\n", pow(-39,2));
printf("%d\n", -39 * -39);
t = i * i + i +41;
printf("%d\n", t);
for (int j = 2; j <= t; ++j)
{
if (t % j == 0)
{
flag = 1;
printf("NO!\n");
printf("%d\n", t);
printf("%d\n", i);
return 1;
}
}
printf("YES!\n");
}
return 0;
}