Skip to content

Instantly share code, notes, and snippets.

@amireshoon
Created September 3, 2020 12:48
Show Gist options
  • Save amireshoon/08800431692ca7f02ea61ec879671360 to your computer and use it in GitHub Desktop.
Save amireshoon/08800431692ca7f02ea61ec879671360 to your computer and use it in GitHub Desktop.
BMI
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
func main() {
reader := bufio.NewReader(os.Stdin)
a, err := reader.ReadString('\n')
if err != nil {
panic("input error")
}
a = strings.Replace(a, "\n", "", -1)
i, err := strconv.Atoi(a)
if err != nil {
// handle error
panic(err)
}
b, err := reader.ReadString('\n')
if err != nil {
panic("input error")
}
b = strings.Replace(b, "\n", "", -1)
i2, err := strconv.ParseFloat(b, 32)
if err != nil {
panic(err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment