作业4.称体重

男人的标准体重是:体重(kg)=身高(cm)-100。
女人的标准体重是:体重(kg)=身高(cm)-110。
上下浮动3公斤属正常
要求输入性别、身高和体重,输出正常,偏胖,偏瘦

 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 
 6 namespace ConsoleApplication1
 7 {
 8     class 体重
 9     {
10         static void Main(string[] agre)
11         {
12             Console.Write("请输入你的性别(男,女):");
13             string sex = Console.ReadLine();
14             Console.Write("请输入你的身高(cm):");
15             string h = Console.ReadLine();
16             int high = Convert.ToInt32(h);
17             Console.Write("请输入你的体重(KG):");
18             string m = Console.ReadLine();
19             int t = Convert.ToInt32(m);
20 
21             if (sex == "")
22             {
23                 if (t > high - 100 + 3) 
24                 {
25                     Console.WriteLine("你的体重偏胖。");
26                 }
27                 else if (t < high - 100 - 3)
28                 {
29                     Console.WriteLine("你的体重偏瘦。");
30                 }
31                 else if (t >=high - 100 -3&& t<= high -100 +3)
32                 {
33                     Console.WriteLine("你的体重正常");
34                 }
35             }
36             else if (sex == "")
37             {
38                 if (t > high - 110 + 3)
39                 {
40                     Console.WriteLine("你的体重偏胖。");
41                 }
42                 else if (t < high - 110 - 3)
43                 {
44                     Console.WriteLine("你的体重偏瘦。");
45                 }
46                 else
47                 {
48                     Console.WriteLine("你的体重正常");
49                 }
50             }
51             else
52             {
53                 Console.WriteLine("输入的不正确,请核实。");
54             }
55         }
56     }
57 }

 

转载于:https://www.cnblogs.com/viven/p/4178968.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值