已做
求π的近似值那题为什么这样编译就不运行啊
#include <stdio.h>
#include <math.h>
int main()
{
double sum=0,i=1;
while((fabs(1/i))>1e-8)
{
sum=(1/i)+sum;
i=-(i+2);
}
sum=sum*4;
printf("Pi的近似值为%.7f",sum);
return o;
}
甲鱼好好好
谢谢
#include <stdio.h>
#include <stdlib.h>
int main()
{
float jia=10000,hei=10000;
int i=0;
while(1){
jia=jia+10000*0.1;
hei=hei*1.05;
i=i+1;
if(hei>jia){
printf("%d年后,黑夜的投资额超过了小甲鱼。\n",i);
printf("小甲鱼的投资额是%.2f\n",jia);
printf("黑夜的投资额是%.2f\n",hei);
break;
}
}
}
学习学习
学习学习
本帖最后由 re-born 于 2017-1-26 21:17 编辑
0,10个
1,个
2,a=b,b=c,c=5, a b c
3,a=30,b=3,c=14
4,z=x>0?x:-x;
5,if (size>12)
{
cost=cost81.05;
flag=2;
}
else
{
bill=cost*flag;
}
B
sheds>14?3:2;
help=2*sheds;
Cif(score<0)
{
printf("count=%d\n",count);
}
count++;
scanf("%d",&score);
Q-Q
daan
朕想知道
qqqqqqqqqqqqqqqq
0. 10个A 逗号表达式取的是j!=10
1. 不会打印B 因为while(0)就没有进入循环
2. a,b,c都是吧
3.14;5;9
4. Z=x>0?x:(-x);
5.
A.
if (size > 12)
{
cost = cost * 1.05;
flag = 2;
}
bill = cost * flag;
B.
if (ibex > 14)
{
sheds = 3;
}
sheds = 2;
help = 2 * sheds;
C.
if (score < 0)
{
printf("count = %d\n", count);
}
count++;
scanf("%d", &score);
0.程序有误,for()i = 0; i = 10, j != 10; i++)时打印10个
1.10个
2.a
3.b = 3,c = 9,
4.z = x > 0 ? x : -x;
5.A.if(size > 12)
{
cost = cost * 1.05;
flag = 2;
}
else
{
bill = cost * flag;
}
B.if(ibex > 14)
{
sheds = 3;
}
else
{
help = 2 * sheds;
}
sheds = 2;
C.if(score < 0)
{
printf(“count = %d\n”, count);
}
count++;
scanf(“%d”,&score);
0.#include <stdio.h>
#include <math.h>
int main() {
float a, b;
int i = 1;
while (a > b) {
a = 10000 * (1 + 0.1 * i);
b = 10000 * pow((1 + 0.05), i);
i++;
}
printf("%d年后,黑夜的投资额超过小甲鱼!\n小甲鱼的投资额是:%.2f\n黑夜的投资额是:%.2f", i - 1, a, b);
return 0;
}
1.#include <stdio.h>
#include <math.h>
int main() {
int year = 1, a;
while (a > 0) {
a = ((4000000 * (1 + 0.08 * year)) - (500000 * year));
year++;
}
printf("%d年之后,小甲鱼败光了所有的家产,再次回到一贫如洗.....", year);
return 0;
}
剩下的实在是太难了啊
课后测试题及答案
搞定……
期待
朕要看
```
0.10个
1.11个
2.a,b,c
3.a = 16,b = 6,c = 10;
4.
if(x>0)
{
z = x;
}
else
{
z = -x;
}
5.
A.
if(size > 12)
{
const = const * 1.05;
flag = 2;
}
bill = cost *flag;
B.
if(ibex > 14)
{
sheds = 3;
}
sheds = 2;
help = 2 * sheds;
C.
count++;
scanf("%d",&score);
if(score < 0)
{
printf("count = %d\n",count);
}