s1e6最后一题在Linux上无法显示帮我看看哪里错了,谢谢
int main(){
unsigned long long sum = 0;
unsigned long long temp;
unsigned long long weight;
int i;
for (i=0; i < 64; i++)
{
temp = pow(2, i);
sum = sum + temp;
}
weight = sum / 25000;
printf("舍罕王应该给予达依尔%llu粒麦子!\n", sum);
printf("如果每25000粒麦子为1kg,那么应该给%llu公斤麦子!\n", weight);
return 0;
}
改了中文的。
int main()
{
unsigned long long sum = 0;
unsigned long long temp;
unsigned long long weight;
int i;
for (i=0; i < 64; i++)
{
temp = pow(2, i);
sum = sum + temp;
}
weight = sum / 25000;
printf("鑸嶇綍鐜嬪簲璇ョ粰浜堣揪渚濆皵 %llu 绮掗害瀛愶紒\n",sum);
printf("濡傛灉姣?5000绮掗害瀛愪负1kg锛岄偅涔堝簲璇ョ粰 %llu 鍏枻楹﹀瓙锛乗n",weight);
return 0;
}
没改动的 我懂了,math数据库要用gcc -lm 文件名.c
汪瑜聪 发表于 2019-10-14 13:41
我懂了,math数据库要用gcc -lm 文件名.c
还得加头文件:
#include <stdio.h>
#include <math.h>
页:
[1]