FastFoodCoding

Login


Connect with one of the following accounts





Login

Please wait while we redirect...

Views: 21   



Following program shows you how to take a number as input and calculate the square root of given number.
In this program we get input from user and calculate square root using math.Sqrt() method

package main

import "fmt"
import "math"

func main() {

  var input float64
  var result float64
  fmt.Println("Please enter a number:")
  fmt.Scanf("%f", &input)
  result = math.Sqrt(input)
  fmt.Println("Square root of " , input , " is: " , result)
}

Output:

Please enter a number:
 16
Square root of  16  is:  4



On By


Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News