#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
int n,i,ele;
n=5;
ele=pow(n,2);
printf("%d",ele);
return 0;
}
输出是24
。
我在 Code::Blocks 中使用 GNU/GCC。
怎么了?
我知道该pow
函数返回 a double
,但25
适合 int 类型,那么为什么此代码打印 a24
而不是 a 25
?如果n=4; n=6; n=3; n=2;
代码有效,但使用五个则无效。