0
Temperature Checker 13.2 Go/Golang Basic Concepts If/else
What is the answer? You are writing a program for a temperature checking system at an airport. The system measures the body temperature of a person and needs to output "Allowed" if it is in the normal range, or "Fever" if it is higher than normal. Normal: up to 99.5 °F Fever: > 99.5 °F The program should take the temperature as a float from input and output the corresponding message. Sample Input: 101.3 Sample Output: Fever
5 Réponses
+ 3
Please correct this
package main
import "fmt"
func main() {
//your code goes here
var input float
fmt.Scanln(&temperature)
if temperature := 99.5; temperature > 99.5 {
fmt.Println("Allowed")
} else {
fmt.Println("Fever")
}
}
+ 2
Hello.
First please show us your attempts. Then we can help you.
Thanks. Happy Programming!!!
+ 1
here you go!
package main
import "fmt"
func main() {
//your code goes here
var temper float32
fmt.Scanln(&temper)
if temper < 99.5 {
fmt.Println("Allowed")
} else {
fmt.Println("Fever")
}
}
0
I need this
0
package main
import "fmt"
func main() {
var t float32
fmt.Scanln(&t)
if t > 99.5{
fmt.Println("Fever")
} else {
fmt.Println("Allowed")
}
}
Code this it works