当前位置:网站首页>Is the C language too fat
Is the C language too fat
2022-07-02 09:41:00 【FF small confused acridine~】
It is said that a person's standard weight should be his height ( Company : centimeter ) subtract 100、 Multiplied by 0.9 The kilogram obtained . The error between the real weight and the standard weight is 10% Inside is the perfect figure ( namely | True weight − Standard weight | < Standard weight × 10%). Now give a group of people's height and actual weight , Please tell them if they are too fat or too thin .
problem :
According to the title, please , Write a program to judge weight .
Programming requirements :
1、 Judge the weight according to the requirements given in the title , With the help of printf Function output result ;
2、 Use scanf Function to input data ;
3、 Please output strictly according to the output effect ;( Affect the performance evaluation )
4、 When submitting the code of the task, it is necessary to ensure that it conforms to the industry code specification , You need to indent and wrap as necessary .( Affect the performance evaluation )
Running effect 1:
Please enter height and weight information , height ( centimeter ) weight ( kg ):171 65
You are a standard weight !
Please press any key to continue . . .
Running effect 2:
Please enter height and weight information , height ( centimeter ) weight ( kg ):171 77
You are too fat !
Please press any key to continue . . .
Running effect 3:
Please enter height and weight information , height ( centimeter ) weight ( kg ):160 46
You are too thin !
Please press any key to continue . . .
#include <stdio.h>
int main(void)
{
double H ,W ,result;
printf(" Please enter height and weight information , height ( centimeter ) weight ( kg ):");
scanf("%lf%lf", &H ,&W);
result = (H - 100) * 0.9;
if(W >= result * 1.1 )
printf(" You are too fat !\n");
else if(W <= result * 0.9)
printf(" You are too thin !\n");
else
printf(" You are a standard weight !\n");
return 0;
}
#include <stdio.h>
int main(void)
{
double h,w,a;
printf(" Please enter height and weight information , height ( centimeter ) weight ( kg ):");
scanf("%d %d",&h,&w);
a=(h-100)*0.9;
if(w-a>=0){
if((w-a)<a*0.1){
printf(" You are a standard weight !\n");
} else if((w-a)>=a*0.1){
printf(" You are too fat !\n");
}
} else{
if((a-w)<a*0.1){
printf(" You are a standard weight !\n");
} else if((a-w)>=a*0.1){
printf(" You are too thin !\n");
}
}
return 0;
}
边栏推荐
- int与string、int与QString互转
- Supplier selection and prequalification of Oracle project management system
- c语言编程题
- Cmake command - Official Document
- 上班第一天的报错(Nessus安装winpcap报错)
- Customize redis connection pool
- ZK configuration center -- configuration and use of config Toolkit
- Microservice practice | Eureka registration center and cluster construction
- Mysql 多列IN操作
- How to choose between efficiency and correctness of these three implementation methods of distributed locks?
猜你喜欢
Chrome video download Plug-in – video downloader for Chrome
How to install PHP in CentOS
分享一篇博客(水一篇博客)
Don't look for it. All the necessary plug-ins for Chrome browser are here
图像识别-数据标注
Off grid control of three-phase inverter - PR control
kinect dk 获取CV::Mat格式的彩色RGB图像(openpose中使用)
Probability is not yet. Look at statistical learning methods -- Chapter 4, naive Bayesian method
Tinyxml2 reading and modifying files
定时线程池实现请求合并
随机推荐
2837xd code generation - Summary
Timed thread pool implements request merging
保存视频 opencv::VideoWriter
Chrome video download Plug-in – video downloader for Chrome
每天睡觉前30分钟阅读_day4_Files
Demand delineation executive summary
Operation and application of stack and queue
个人经历&&博客现状
企业级SaaS CRM实现
Long summary (code with comments) number structure (C language) -- Chapter 4, string (Part 1)
How to choose between efficiency and correctness of these three implementation methods of distributed locks?
2837xd Code Generation - stateflow (4)
Bugkuctf-web21 (detailed problem solving ideas and steps)
Chrome browser plug-in fatkun installation and introduction
上班第一天的报错(AWVS卸载不彻底)
vs+qt 设置应用程序图标
Amq6126 problem solving ideas
How to use PHP spoole to implement millisecond scheduled tasks
Pool de connexion redis personnalisé
Number structure (C language -- code with comments) -- Chapter 2, linear table (updated version)