当前位置:网站首页>C语言之到底是不是太胖了
C语言之到底是不是太胖了
2022-07-02 06:34:00 【FF小迷糊吖~】
据说一个人的标准体重应该是其身高(单位:厘米)减去100、再乘以0.9所得到的公斤数。真实体重与标准体重误差在10%以内都是完美身材(即 | 真实体重 − 标准体重 | < 标准体重 × 10%)。现给定一群人的身高和实际体重,请你告诉他们是否太胖或太瘦了。
问题:
请根据题目要求,编写程序实现体重的判断。
编程要求:
1、 按照题目中给出要求进行体重判断,并借助printf函数输出结果;
2、 使用scanf函数进行数据的输入;
3、 请严格按照输出效果输出;(影响成绩评定)
4、任务提交代码时需保证其符合行业代码规范,需进行必要的缩进及换行。(影响成绩评定)
运行效果1:
请输入身高体重信息,身高(厘米)体重(公斤):171 65
您是标准体重!
请按任意键继续. . .
运行效果2:
请输入身高体重信息,身高(厘米)体重(公斤):171 77
您太胖了!
请按任意键继续. . .
运行效果3:
请输入身高体重信息,身高(厘米)体重(公斤):160 46
您太瘦了!
请按任意键继续. . .
#include <stdio.h>
int main(void)
{
double H ,W ,result;
printf("请输入身高体重信息,身高(厘米)体重(公斤):");
scanf("%lf%lf", &H ,&W);
result = (H - 100) * 0.9;
if(W >= result * 1.1 )
printf("您太胖了!\n");
else if(W <= result * 0.9)
printf("您太瘦了!\n");
else
printf("您是标准体重!\n");
return 0;
}
#include <stdio.h>
int main(void)
{
double h,w,a;
printf("请输入身高体重信息,身高(厘米)体重(公斤):");
scanf("%d %d",&h,&w);
a=(h-100)*0.9;
if(w-a>=0){
if((w-a)<a*0.1){
printf("您是标准体重!\n");
} else if((w-a)>=a*0.1){
printf("您太胖了!\n");
}
} else{
if((a-w)<a*0.1){
printf("您是标准体重!\n");
} else if((a-w)>=a*0.1){
printf("您太瘦了!\n");
}
}
return 0;
}
边栏推荐
- Watermelon book -- Chapter 5 neural network
- Cloudrev self built cloud disk practice, I said that no one can limit my capacity and speed
- How to use pyqt5 to make a sensitive word detection tool
- [staff] time mark and note duration (staff time mark | full note rest | half note rest | quarter note rest | eighth note rest | sixteenth note rest | thirty second note rest)
- The channel cannot be viewed when the queue manager is running
- 定时线程池实现请求合并
- Programmers with ten years of development experience tell you, what core competitiveness do you lack?
- 十年开发经验的程序员告诉你,你还缺少哪些核心竞争力?
- Microservice practice | teach you to develop load balancing components hand in hand
- 机器学习之数据类型案例——基于朴素贝叶斯法,用数据辩男女
猜你喜欢

Enterprise level SaaS CRM implementation

微服务实战|微服务网关Zuul入门与实战

Machine learning practice: is Mermaid a love movie or an action movie? KNN announces the answer

告别996,IDEA中必装插件有哪些?

DTM distributed transaction manager PHP collaboration client V0.1 beta release!!!

概念到方法,绝了《统计学习方法》——第三章、k近邻法

Probability is not yet. Look at statistical learning methods -- Chapter 4, naive Bayesian method

I've taken it. MySQL table 500W rows, but someone doesn't partition it?
![[go practical basis] how can gin get the request parameters of get and post](/img/fd/66074d157d93bcf20a5d3b37da9b3e.png)
[go practical basis] how can gin get the request parameters of get and post

十年开发经验的程序员告诉你,你还缺少哪些核心竞争力?
随机推荐
What are the differences between TP5 and laravel
Learn combinelatest through a practical example
Pool de connexion redis personnalisé
【Go实战基础】gin 如何验证请求参数
自定義Redis連接池
Redis sorted set data type API and application scenario analysis
互联网API接口幂等设计
[go practical basis] how to install and use gin
分布式锁的这三种实现方式,如何在效率和正确性之间选择?
Chrome video download Plug-in – video downloader for Chrome
Chrome browser plug-in fatkun installation and introduction
京东高级工程师开发十年,编写出:“亿级流量网站架构核心技术”
「Redis源码系列」关于源码阅读的学习与思考
Say goodbye to 996. What are the necessary plug-ins in idea?
【Go实战基础】gin 如何设置路由
How to use pyqt5 to make a sensitive word detection tool
Typora安装包分享
Chrome browser tag management plug-in – onetab
Machine learning practice: is Mermaid a love movie or an action movie? KNN announces the answer
View the port of the application published by was