Advertisement
fbinnzhivko

01.00 Daily Calorie Intake

Apr 15th, 2016
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.06 KB | None | 0 0
  1. using System;
  2. class Program
  3. {
  4.     static void Main()
  5.     {
  6.         double weight = int.Parse(Console.ReadLine()) / 2.2;
  7.         double height = int.Parse(Console.ReadLine()) * 2.54;
  8.  
  9.         int age = int.Parse(Console.ReadLine());
  10.         char gender = char.Parse(Console.ReadLine());
  11.         int workoutsPerWeek = int.Parse(Console.ReadLine());
  12.  
  13.         double dci = 1;
  14.         if (workoutsPerWeek <= 0) { dci = 1.2; }
  15.         else if (workoutsPerWeek >= 1 && workoutsPerWeek <= 3) { dci = 1.375; }
  16.         else if (workoutsPerWeek >= 4 && workoutsPerWeek <= 6) { dci = 1.55; }
  17.         else if (workoutsPerWeek >= 7 && workoutsPerWeek <= 9) { dci = 1.725; }
  18.         else if (workoutsPerWeek > 9) { dci = 1.9; }
  19.  
  20.         if (gender == 'm')
  21.         {
  22.             Console.WriteLine("{0:f0}", Math.Floor((66.5 + 13.75 * weight + 5.003 * height - 6.755 * age) * dci));
  23.         }
  24.         else if (gender == 'f')
  25.         {
  26.             Console.WriteLine("{0:f0}", Math.Floor((655 + 9.563 * weight + 1.850 * height - 4.676 * age) * dci));
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement