zoukankan      html  css  js  c++  java
  • 作业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 }
  • 相关阅读:
    Linux中常用操作命令
    JQuery Each循环遍历每个元素
    get set
    Launch Screen在iOS7/8中的实现
    程序猿必备的Git教程
    浏览器的工作原理:新式网络浏览器幕后揭秘
    浏览器的工作原理:新式网络浏览器幕后揭秘
    游览器中javascript的执行过程
    游览器中javascript的执行过程
    浅析 Cordova for iOS
  • 原文地址:https://www.cnblogs.com/viven/p/4178968.html
Copyright © 2011-2022 走看看