mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
896 B
896 B
is-square
Instructions
Write a function IsSquare
that takes two numbers and returns true
if the second number is the square of the first and false
otherwise.
- The function should return
false
if any of the parameters are negative - Check only if the second parameter is the square of the first one.
Expected Function
func IsSquare(number int, square int) bool {
// your code here
}
Usage
Here is a possible program to test your function:
package main
import "fmt"
func main(){
fmt.Println(IsSquare(4, 16))
fmt.Println(IsSquare(5, 23))
fmt.Println(IsSquare(5, 25))
fmt.Println(IsSquare(2, 27))
fmt.Println(IsSquare(6, 36))
fmt.Println(IsSquare(-10, 100))
fmt.Println(IsSquare(100,10))
fmt.Println(IsSquare(8, -64))
}
and its output:
$ go run .
true
false
true
false
true
false
false
false