Advertisement
Guest User

Untitled

a guest
Dec 14th, 2015
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _01.DailyCalorieIntake
  8. {
  9. class DailyCalorieIntake
  10. {
  11. static void Main(string[] args)
  12. {
  13. int weight = int.Parse(Console.ReadLine());
  14. int height = int.Parse(Console.ReadLine());
  15. int age = int.Parse(Console.ReadLine());
  16. char gender = char.Parse(Console.ReadLine());
  17. int workouts = int.Parse(Console.ReadLine());
  18.  
  19. double weightKG = (double)weight / 2.2;
  20. double heightCM = (double)height * 2.54;
  21.  
  22. double BMR = 0.0;
  23. double constant = 0.0;
  24.  
  25. if (gender == 'm')
  26. {
  27. BMR = 66.5 + (13.75 * weightKG) + (5.003 * heightCM) - (6.755 * age);
  28. }
  29. else
  30. {
  31. BMR = 655 + (9.563 * weightKG) + (1.85 * heightCM) - (4.676 * age);
  32. }
  33.  
  34. if (workouts <= 0)
  35. {
  36. constant = 1.2;
  37. }
  38. else if (workouts >= 1 && workouts <= 3)
  39. {
  40. constant = 1.375;
  41. }
  42. else if (workouts >= 4 && workouts <= 6)
  43. {
  44. constant = 1.55;
  45. }
  46. else if (workouts >= 7 && workouts <= 9)
  47. {
  48. constant = 1.725;
  49. }
  50. else
  51. {
  52. constant = 1.9;
  53. }
  54.  
  55. Console.WriteLine(Math.Floor(BMR * constant));
  56. }
  57. }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement