对比迪比
查看参考答案
康康答案
#include<stdio.h>
#include<math.h>
int main()
{
float a,a1=10000,b,b1=10000;
int year=0;
for(a=10000,b=10000;b1<=a1;year++)
{
a1=a*(1+year*0.1);
b1=b*(pow(1.05,year));
}
printf("%dÄêoó£¬bí¶×ê3¬1ya£»\nÆäÖDa=%.2f,b=%.2f\n",year,a1,b1);
return 0;
}
#include<stdio.h>
#include<math.h>
int main()
{
int year,get=50;
float money,money1;
for(money=400;money>0;year++)
{
money=money-get;
money=money*(1.08);
}
printf("%dÄêoó£¬Ç®½«è«2¿óÃíê¡£\n",year);
return 0;
}
#include<stdio.h>
#include<math.h>
int main()
{
float start,num,result,check;
int i;
for(start=-1,num=1,result=0,i=0;fabs(check)>=pow(10,-8);start=+2,i++);
{
check=num/start;
if(!(i%2))
{
result=result-check;
}
else
{
result=result+check;
}
}
printf("%.2f\n",result);
return 0;
}
朕想知道
朕想知道
0.90个
1.10次
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;
}
else
{
bill = cost * flag;
}
B
if (ibex > 14)
{
sheds = 3;
}
else
{
sheds = 2;
help = 2 * sheds;
}
C
while()
{
if (score < 0)
{
printf("count = %d\n", count);
break;
}
else
{
scanf("%d", &score);
count++;
}
}
D
0.#include<stdio.h>
#include<math.h>
int main()
{
double money = 10000.00;
int year = 0;
double xiaojiayu = 0;
double heiye = 0;
year = 1;
while(xiaojiayu >= heiye)
{
xiaojiayu = money * (1 + 0.10 * year);
heiye = money * pow(1.05,year);
year++;
}
printf("%d年后,黑夜的投资额超过小甲鱼!\n小甲鱼的投资额是:%.2f\n黑夜的投资额是:%.2f\n",year - 1,xiaojiayu,heiye);
return 0;
}
1.
测试题:
0. 请问下边代码将打印多少个 'A'?
#include <stdio.h>
int main()
{
int i, j;
for (i = 0; i != 10, j != 10; i++)
{
for (j = 0; j < 10; j++)
{
putchar('A');
}
}
putchar('\n');
return 0;
}
10个'A'
1. 请问下边代码会打印多少个 'B'?
#include <stdio.h>
int main()
{
int i = 0;
while (i++)
{
if (i > 10)
{
goto Label;
}
putchar('B');
}
Label:putchar('\n');
return 0;
}
9个'B'
2. 请写出表达式 a = b = c = 5 中的"l-value"?
c,b,a
3. 请问表达式 a = (b = 3, 4, c = b++ + 5, ++c + ++b); 执行后,整型变量 a、b、c 的值是?
a=14
b=5
c=9
4. 请使用条件运算符求出变量 x 的绝对值,并存放到变量 z 中。
z=x?abs(x):x
5. C 语言其实在大部分情况下不使用 goto 语句也能做得很好,请尝试将下列代码段写成不带 goto 语句的版本。
A:
if (size > 12)
{
goto a;
}
goto b;
a: cost = cost * 1.05;
flag = 2;
b: bill = cost * flag;
if (size > 12)
{
cost = cost*1.05;
flag = 2;
}
bill = cost * flag;
B:
if (ibex > 14)
{
goto a;
}
sheds = 2;
goto b;
a: sheds = 3;
b: help = 2 * sheds;
if (ibex > 14)
{
sheds = 3;
}
sheds = 2;
help = 2*sheds;
C:
readin: scanf("%d", &score);
if (score < 0)
{
goto stage2;
}
count++;
goto readin;
stage2: printf("count = %d\n", count);
if (score < 0)
{
printf("count = %d\n", count);
}
count++;
scanf("%d",&score);
。
好的
打卡
做完看看答案
继续学习
adsadsdas
574
学习
答案
1
81
vvvvv