求助,为什么结果和我答案不一样呢
第六课的内容,答案和结果不一样,不知道错在哪了 这里应该是小写字母l而不是数字1printf("舍罕王应该给予达依尓%llu粒麦子\n",sum);
printf("如果每25000粒麦子为1kg,那么应该给%llu公斤麦子\n",weight); 发代码 #include<stdio.h>
#include<math.h>
int main()
{
unsigned long long int sum=0;
unsigned long long int temp;
unsigned long long int weight;
int i;
for (i=0;i<64;i++)
{
temp=pow(2,i);
sum=sum+temp;
}
weight=sum / 25000;
printf("舍罕王应该给予达依尓%11u粒麦子\n",sum);
printf("如果每25000粒麦子为1kg,那么应该给%11u公斤麦子\n",weight);
return 0;
}
#include<stdio.h>
#include<math.h>
int main()
{
unsigned long long int sum=0;
unsigned long long int temp;
unsigned long long int weight;
int i;
for (i=0;i<64;i++)
{
temp=pow(2,i);
sum=sum+temp;
}
weight=sum / 25000;
printf("舍罕王应该给予达依尓%11u粒麦子\n",sum);
printf("如果每25000粒麦子为1kg,那么应该给%11u公斤麦子\n",weight);
return 0;
}
1和l要分清
页:
[1]