Advertisement
Sim0o0na

02. Calorie Calculator

Apr 30th, 2018
718
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ExamTest2
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. char gender = char.Parse(Console.ReadLine());
  10. double weight = double.Parse(Console.ReadLine());
  11. double height = double.Parse(Console.ReadLine());
  12. int age = int.Parse(Console.ReadLine());
  13. string physicalActivity = Console.ReadLine();
  14.  
  15. double blm = 0.0;
  16.  
  17. if (gender == 'm')
  18. {
  19. blm = 66 + (13.7 * weight) + (5 * height * 100) - (6.8 * age);
  20. }
  21. else if (gender == 'f')
  22. {
  23. blm = 655 + (9.6 * weight) + (1.8 * height * 100) - (4.7 * age);
  24. }
  25.  
  26. if (physicalActivity == "sedentary")
  27. {
  28. blm *= 1.2;
  29. }
  30. else if (physicalActivity == "lightly active")
  31. {
  32. blm *= 1.375;
  33. }
  34. else if (physicalActivity == "moderately active")
  35. {
  36. blm *= 1.55;
  37. }
  38. else if (physicalActivity == "very active")
  39. {
  40. blm *= 1.725;
  41. }
  42.  
  43. Console.WriteLine($"To maintain your current weight you will need {Math.Ceiling(blm)} calories per day.");
  44. }
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement