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.

51 lines
896 B

## is-square
### Instructions
2 years ago
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
```go
2 years ago
func IsSquare(number int, square int) bool {
// your code here
}
```
### Usage
2 years ago
Here is a possible program to test your function:
``` go
package main
import "fmt"
func main(){
2 years ago
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:
```console
$ go run .
true
false
true
false
true
false
false
2 years ago
false
```