Advertisement
Spocoman

10. Multiply by 2

Sep 19th, 2024
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.28 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6.     var number float64
  7.  
  8.     for ; ; {
  9.         fmt.Scanln(&number)
  10.         if(number >= 0) {
  11.             fmt.Printf("Result: %.2f\n", number * 2)
  12.         } else {
  13.             fmt.Println("Negative number!")
  14.             break
  15.         }
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement