Bingohan
发表于 2019-5-31 20:36:44
输入实数,输出实数绝对值
#include <stdio.h>
int main()
{
while (1)
{
float x; //输入
float z; //输出
printf("请输入x的值:");
scanf_s("%f", &x);
if (x < 0)
{
z = -x;
}
else
{
z = x;
}
printf("%.2f的绝对值为:%.2f\n", x,z);
putchar('\n');
}
return 0;
}
Bingohan
发表于 2019-5-31 20:57:21
A:
if (x > 12)
{
cost *= 1.05;
flag = 2;
}
else
{
bill = cost * flag;
}
B:
if (ibex > 14)
{
sheds = 3;
}
else
{
sheds = 2;
}
help = 2 * sheds;
C:
if (score < 0)
{
printf("count=%d\n"count);
}
else
{
count++;
}
scanf("%d", &score);
BigStrong
发表于 2019-5-31 22:07:03
学习
15135785128
发表于 2019-6-2 15:49:47
setsrtst
Bingohan
发表于 2019-6-2 19:22:22
#include <stdio.h>
#define danlixi0.1 //小甲鱼存款模式 单利息 利率10%
#define fuhelixi 0.05 //黑夜存款模式,单利息 利率5%
int main()
{
int i=1; //存储年份
double sum_1 = 0; //存储小甲鱼的本加息
double sum_2 = 0; //存储黑夜模式的本加息
double benjin;
while (sum_1 >= sum_2)
{
i++;
benjin = 10000;
sum_1 =i * benjin * danlixi + benjin;
for (int k = 1; k <= i; k++)
{
sum_2 = benjin = benjin * 0.05 + benjin;
}
}
printf("存入%d年后,小甲鱼本息和为%.2f\n", i, sum_1);
printf("存入%d年后,黑夜的本息和为%.2f\n", i, sum_2);
return 0;
}
Mumun
发表于 2019-6-3 10:47:38
l
justjust001
发表于 2019-6-3 23:22:44
打卡学习
sakuraslor
发表于 2019-6-5 17:22:07
1
a494006257
发表于 2019-6-7 18:20:26
0.10次,因为只有内循环有打印A外循环没有告诉需要打印A。
1.11次
2.a,b,c
3.a = 15, b = 9, c = 4
4. z = x + -x == 0 ?z : x
5.
Kagari
发表于 2019-6-8 15:29:47
0.
10
1.
0
2.
a b c
3.
c=9 b=5 a=14
4.if (x<0 && z=-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 score > 0
scanf("%d", &score);
count++;
printf("count = %d\n", count);
0.
if xiao < chu
xiao += xiao_init*1.1
chu = chu*1.05
year++
1.
#include<stdio.h>
#include<stdio.h>
int main()
{
int money = 400*1000,count=0;
while (money >= 0)
{
money -=50*1000;
money = money*1.08;
count ++;
}
printf("%d",count);
return 0;
}
2.
#include<stdio.h>
#include<math.h>
int main()
{
float i,pi=0,fuhao=1;
for (i=0;fabs(1/(2*i+1)) > 0.0000001;i++)
{
pi+=(1/(2*i+1))*fuhao;
fuhao=-fuhao;
}
printf("%f",pi*4);
}
Lanckie
发表于 2019-6-8 15:50:08
feibonaqi太难了
lianl
发表于 2019-6-9 09:24:45
{:10_257:}{:10_257
JulyJoker
发表于 2019-6-10 14:41:29
{:10_277:}
newnhoj
发表于 2019-6-11 17:44:52
kandanaanna l
453022113
发表于 2019-6-12 13:49:38
1111
Rookie很菜鸟
发表于 2019-6-13 09:03:52
...
克里斯保罗
发表于 2019-6-13 12:42:46
0.100
1.10
2.c
3.a = 3 ,c = 9 , b = 5
4.z = x<0?-x:x
5.if (size > 12)
{
cost = cost * 1.05;
flag = 2;
bill = cost * flag;
}
if(ibex > 14)
{
sheds = 3;
help = 2 * sheds;
}
if(score < 0)
{
printf("count = %d\n",count);
}
else
{
count ++
scanf("%d",&score);
}
请叫我小叮当
发表于 2019-6-15 15:38:13
0:回答出10个'A'
1:一个都不会打印。
2:a = 5;
3: a == 14, b == 5, 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;
}
C: while (score >= 0)
{
count++;
scanf("%d", &score);
}
printf("count = %d\n", count);
动动手:
0: for (years = 1; single >= compound; years++)
{
//l=p*i*n
single = 10000 + (10000 * (0.1 * years));
//s=p*(1+i)^n
compound = (10000 * pow((1 + 0.05), years));
++year;
}
printf("%d年后,黑夜的投资额超过王八蛋!\n\
王八蛋的投资额是:%.2f\n\
黑夜的投资额是:%.2f", year, single, compound);
1:
for (years = 1; total_amount > 0; years++)
{
total_amount = total_amount - 500000;
total_amount = (total_amount * 0.08) + total_amount;
if (total_amount <= 500000)
{
total_amount = total_amount - total_amount;
}
}
printf("%d年之后,会小王八^_^会败光所有家产,再次一穷二白。", years);
2:
3:
多放点香菜
发表于 2019-6-15 21:05:50
over
1067551775
发表于 2019-6-17 21:19:19
f