Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var volume, pipe1, pipe2 int
- fmt.Scanln(&volume)
- fmt.Scanln(&pipe1)
- fmt.Scanln(&pipe2)
- var hours float64
- fmt.Scanln(&hours)
- var poolV = float64(pipe1 + pipe2) * hours
- var poolP = poolV / float64(volume)
- if (float64(volume) >= poolV) {
- fmt.Printf("The pool is %.2f%% full. Pipe 1: %.2f%%. Pipe 2: %.2f%%.",
- poolP * 100, float64(pipe1) / poolV * hours * 100, float64(pipe2) / poolV * hours * 100)
- } else {
- fmt.Printf("For %f hours the pool overflows with %.2f liters.", hours, poolV - float64(volume))
- }
- }
- ИЛИ:
- package main
- import "fmt"
- func main() {
- var volume, pipe1, pipe2, hours float64
- fmt.Scanln(&volume)
- fmt.Scanln(&pipe1)
- fmt.Scanln(&pipe2)
- fmt.Scanln(&hours)
- var poolV = (pipe1 + pipe2) * hours
- var poolP = poolV / volume
- if (volume >= poolV) {
- fmt.Printf("The pool is %.2f%% full. Pipe 1: %.2f%%. Pipe 2: %.2f%%.",
- poolP * 100, pipe1 / poolV * hours * 100, pipe2 / poolV * hours * 100)
- } else {
- fmt.Printf("For %f hours the pool overflows with %.2f liters.", hours, poolV - volume)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement