Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- "math"
- "bufio"
- "os"
- )
- func main() {
- var gender string
- fmt.Scanln(&gender)
- var weight, height, basalMetabolicRate, coefficientActivity float64
- fmt.Scanln(&weight)
- fmt.Scanln(&height)
- var age int
- fmt.Scanln(&age)
- scanner := bufio.NewScanner(os.Stdin)
- scanner.Scan()
- physicalActivity := scanner.Text()
- if gender == "m" {
- basalMetabolicRate = 66 + weight * 13.7 + height * 500 - 6.8 * float64(age)
- } else {
- basalMetabolicRate = 655 + weight * 9.6 + height * 180 - 4.7 * float64(age)
- }
- switch physicalActivity {
- case "sedentary":
- coefficientActivity = 1.2
- case "lightly active":
- coefficientActivity = 1.375
- case "moderately active":
- coefficientActivity = 1.55
- default:
- coefficientActivity = 1.725
- }
- calories := int(math.Ceil(basalMetabolicRate * coefficientActivity))
- fmt.Printf("To maintain your current weight you will need %d calories per day.\n", calories)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement