|
|
发表于 2020-8-26 15:54:29
|
显示全部楼层
测试题:
0.
long long int
1.
char
2.
不是,他是一个运算符
3.
8
4.
char
5.
E. F.
6.
unsigned int
7.
_Bool 类型表示True 和 False,计算机只有确定的值
动动手:
0.
- #include <stdio.h>
- #include <math.h>
- int main(void)
- {
- int a;
- a = pow(1, 2) + pow(2, 3) + pow(3, 4) + pow(4, 5) + pow(5, 6);
- printf("1^2 + 2^3 + 3^4 + 4^5 + 5^6 = %d\n", a);
- return 0;
- }
复制代码
1.
- #include <stdio.h>
- #include <math.h>
- int main(void)
- {
- unsigned long long sum, temp, weight;
- sum = 0;
- temp = 0;
- weight = 0;
- int i;
- for (i=0; i<64; i++)
- {
- temp = pow(2, i);
- sum = sum +temp;
- }
- weight = sum / 25000;
- printf("舍汉王应该给予达依尔%u粒麦子!\n", sum);
- printf("如果每25000粒麦子为1kg,那么应该给%u公斤麦子!\n", weight);
- return 0;
- }
复制代码 |
|