zoukankan      html  css  js  c++  java
  • 判断体重偏轻重

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace 判断体重偏轻中
    {
        class Program
        {
            static void Main(string[] args)
            {                                     
                    Console.Write("请输入你的性别:");
                    string s = Console.ReadLine();
                    Console.Write("请输入你的身高(cm):");
                    double a = int.Parse(Console.ReadLine());
                    Console.Write("请输入你的体重(kg):");
                    double b = int.Parse(Console.ReadLine());
                    if (s == "")
                    {
                        double c = b - a + 100;
                        if (c <= 3 && c >= -3)
                        {
                            Console.WriteLine("你的体重标准");
                        }
                        else if (c < -3)
                        {
                            Console.WriteLine("你体重偏瘦");
                        }
                        else
                        {
                            Console.WriteLine("你的体重偏胖");
                        }
                    }
                    else if (s == "")          //此处需要加else,否则将运行显示:输入有误
                    {
                        double d = b - a + 110;
                        if (d <= 3 && d >= -3)
                        {
                            Console.WriteLine("你的体重标准");
                        }
                        if (d < -3)
                        {
                            Console.WriteLine("你体重偏瘦");
                        }
                        else
                        {
                            Console.WriteLine("你的体重偏胖");
                        }
                    }
                    else
                    {
                        Console.WriteLine("输入有误");
    
                    }
                    Console.ReadLine();
              }
        }
    }
  • 相关阅读:
    C#: Create a WebRequest with HTTP Basic Authentication
    C# 集合
    BAT CMD 批处理文件脚本 -2
    年龄排序
    士兵买香蕉
    ACM交换生问题
    ACM卡片游戏
    ACM费马大定理
    ACM定外卖问题
    ACM汽车行程问题求最少的支付钱数
  • 原文地址:https://www.cnblogs.com/qixinjian/p/4585687.html
Copyright © 2011-2022 走看看