Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _2_CalorieCalculator
- {
- class Program
- {
- static void Main()
- {
- char gender = char.Parse(Console.ReadLine());
- double weightKg = double.Parse(Console.ReadLine());
- double heightM = double.Parse(Console.ReadLine());
- int age = int.Parse(Console.ReadLine());
- string phisicalActivity = Console.ReadLine();
- double calories = 0;
- if (gender == 'm')
- {
- calories = 66 + (13.7 * weightKg) + (5 * heightM * 100) - (6.8 * age);
- }
- else if (gender == 'f')
- {
- calories = 655 + (9.6 * weightKg) + (1.8 * heightM * 100) - (4.7 * age);
- }
- switch (phisicalActivity)
- {
- case "sedentary":
- calories *= 1.2;
- break;
- case "lightly active":
- calories *= 1.375;
- break;
- case "moderately active":
- calories *= 1.55;
- break;
- case "very active":
- calories *= 1.725;
- break;
- }
- Console.WriteLine($"To maintain your current weight you will need {Math.Ceiling(calories)} calories per day.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement