mirror of https://github.com/01-edu/public.git
Mohamed Zaboub
2 years ago
committed by
José Rosendo
1 changed files with 32 additions and 0 deletions
@ -0,0 +1,32 @@ |
|||||||
|
# rectperimeter |
||||||
|
|
||||||
|
### Instructions |
||||||
|
|
||||||
|
write a function that accepts two integer arguments, representing the two sides length of a rectangle and returning the perimeter of the rectangle. |
||||||
|
|
||||||
|
your function should return `-1` if one of the arguments is negative. |
||||||
|
|
||||||
|
### Expected function |
||||||
|
|
||||||
|
```go |
||||||
|
func RectPerimeter(l, w int) int { |
||||||
|
|
||||||
|
} |
||||||
|
``` |
||||||
|
|
||||||
|
### Usage |
||||||
|
|
||||||
|
|
||||||
|
```go |
||||||
|
package main |
||||||
|
|
||||||
|
import ( |
||||||
|
"fmt" |
||||||
|
"piscine" |
||||||
|
) |
||||||
|
|
||||||
|
func main() { |
||||||
|
fmt.Println(piscine.RectPerimeter(10, 2)) |
||||||
|
fmt.Println(piscine.RectPerimeter(434343, 898989)) |
||||||
|
} |
||||||
|
``` |
Loading…
Reference in new issue