Advertisement
fbinnzhivko

01. Daily Calorie Intake

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