Advertisement
Guest User

aaaaaaaaaaaaaaaaaaaaaaaaa

a guest
Sep 25th, 2021
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.53 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4.     //  "bufio"
  5.     "fmt"
  6.     "math"
  7.  
  8.     //  "os"
  9.     "strconv"
  10.     //  "errors"
  11. )
  12.  
  13. func main() {
  14.     phrase := "Counting the circles..." //string
  15.  
  16.     fmt.Println(phrase)
  17.     fmt.Println("Please select a radius for a circle")
  18.     var rad float64
  19.     var err error
  20.     _, err = fmt.Scanf("%rad", &rad)
  21.     if err != nil {
  22.         fmt.Println("Scan error", err)
  23.     }
  24.     circlearea(rad)
  25.  
  26. }
  27.  
  28. func circlearea(p float64) {
  29.     area := (math.Pow(p, 2)) * math.Pi
  30.     var printable string = strconv.FormatFloat(area, 'f', 6, 64)
  31.     fmt.Println(printable)
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement