//7-8
#include <stdio.h>
int main()
{
int H;
scanf("%d",&H);
double weight=(H-100)*0.9*2;
printf("%3.1f",weight);
}
7-8 是不是太胖了
#include <stdio.h>
int main()
{
int a,b,c,d;
scanf("%d %d %d %d",&a,&b,&c,&d);
int Sum=a+b+c+d;
float Average=(a+b+c+d)*1.0/4;
printf("Sum = %d; Average = %3.1f",Sum,Average);
return 0;
}
//7-9
7-9 求整数均值
//7-10
#include <stdio.h>
int main()
{
int a,b;
b!=0;
scanf("%d %d",&a,&b);
printf("a + b = %d\n",a+b);
printf("a - b = %d\n",a-b);
printf("a * b = %d\n",a*b);
if (a==0){
printf("a / b = 0");
}
else{
if (a%b==0){
printf("a / b = %d\n",a/b);
}else if(a%b!=0){
printf("a / b = %.2f",(a*1.0)/(b*1.0));
}
}
return 0;
}
7-10 输入:在一行内输出100以内的非负整数a和b,中间以空格间隔,且保证不为0
输出:其和差积商。注意空格换行。
具体戳此C语言控制输出格式-小数点位数
因a/b输出结果与等号相距太大,故将%6.2f改成%.2f.如图
不过结果PTA依旧不承认啊啊啊啊啊,明天再钻研吧doge
2022-3-14编辑
输出格式与原题不符,应改为
细微之处在7.8.9.11行。