Commit 41af3fa3 authored by Martynas Budriūnas's avatar Martynas Budriūnas Committed by Brad Fitzpatrick

math: add a Sqrt example

Change-Id: I259e25b9d0b069912053a250e9739e04fafca54d
Reviewed-on: https://go-review.googlesource.com/48892
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 8cb40fa4
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package math_test
import (
"fmt"
"math"
)
func ExampleSqrt() {
const (
a = 3
b = 4
)
c := math.Sqrt(a*a + b*b)
fmt.Printf("%.1f", c)
// Output: 5.0
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment