예제 #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Введите свой рост, см (целое число): ");
            uint height = ExtraConsole.ReadUintFromConsole();

            Console.WriteLine("Введите свой вес, кг (целое число): ");
            uint   weight        = ExtraConsole.ReadUintFromConsole();
            double bodyMassIndex = weight / (Math.Pow(height / 100d, 2));

            Console.WriteLine($"Ваш индекс массы тела: {bodyMassIndex:f2}");
            Console.ReadKey();
        }
예제 #2
0
        static void Main(string[] args)
        {
            Console.Write("Введите свой вес, кг: ");
            uint weight = ExtraConsole.ReadUintFromConsole();

            Console.Write("Введите свой рост, см: ");
            uint height = ExtraConsole.ReadUintFromConsole();

            double bodyMassIndex = GetBodyMassIndex(weight, height);
            BodyMassIndexInterpretation bodyMassIndexInterpretation = GetBodyMassIndexInterpretation(bodyMassIndex);

            switch (bodyMassIndexInterpretation)
            {
            case BodyMassIndexInterpretation.Thin:
            {
                double massToIncrease = GetMassToIncrease(weight, height);
                Console.WriteLine($"Вы худой. Вам нужно набрать {massToIncrease:f1} кг.");
                break;
            }

            case BodyMassIndexInterpretation.Normal:
            {
                Console.WriteLine("У вас нормальный вес.");
                break;
            }

            case BodyMassIndexInterpretation.Fat:
            {
                double massToDecrease = GetMassToDecrease(weight, height);
                Console.WriteLine($"Вы толстый. Вам нужно сбросить {massToDecrease:f1} кг.");
                break;
            }

            default:
                break;
            }
        }