当前位置:网站首页>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;
}
边栏推荐
猜你喜欢

Image recognition - data augmentation

Tinyxml2 reading and modifying files

2837xd 代碼生成——StateFlow(4)

Knowledge points are very detailed (code is annotated) number structure (C language) -- Chapter 3, stack and queue

Required request body is missing: (cross domain problem)

Typeerror: X () got multiple values for argument 'y‘

JDBC review

Supplier selection and prequalification of Oracle project management system

Idempotent design of Internet API interface

Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedd
随机推荐
MySQL error: unblock with mysqladmin flush hosts
C language programming problems
2837xd 代码生成——StateFlow(3)
2837xd 代码生成——StateFlow(4)
web安全与防御
JDBC review
How to use PHP spoole to implement millisecond scheduled tasks
VIM操作命令大全
Ckeditor 4.10.1 upload pictures to prompt "incorrect server response" problem solution
Number structure (C language) -- Chapter 4, compressed storage of matrices (Part 2)
Read Day6 30 minutes before going to bed every day_ Day6_ Date_ Calendar_ LocalDate_ TimeStamp_ LocalTime
Probability is not yet. Look at statistical learning methods -- Chapter 4, naive Bayesian method
Alibaba / popular JSON parsing open source project fastjson2
Knife4j 2. Solution to the problem of file control without selection when uploading x version files
PI control of three-phase grid connected inverter - off grid mode
三相逆变器离网控制——PR控制
保存视频 opencv::VideoWriter
int与string、int与QString互转
kinect dk 获取CV::Mat格式的彩色RGB图像(openpose中使用)
View the port of the application published by was