fix: rectangle's area -> perimeter
This commit is contained in:
parent
48bf16c035
commit
e3b6c755eb
@ -8,15 +8,15 @@
|
||||
package main
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// EXERCISE: Find the Rectangle's Area
|
||||
// EXERCISE: Find the Rectangle's Perimeter
|
||||
//
|
||||
// 1. Find the area of a rectangle
|
||||
// 1. Find the perimeter of a rectangle
|
||||
// Its width is 5
|
||||
// Its height is 6
|
||||
//
|
||||
// 2. Assign the result to the `area` variable
|
||||
// 2. Assign the result to the `perimeter` variable
|
||||
//
|
||||
// 3. Print the `area` variable
|
||||
// 3. Print the `perimeter` variable
|
||||
//
|
||||
// HINT
|
||||
// Rectangle formula = 2 * (width + height)
|
||||
@ -29,7 +29,7 @@ func main() {
|
||||
// UNCOMMENT THE CODE BELOW:
|
||||
|
||||
// var (
|
||||
// area int
|
||||
// perimeter int
|
||||
// width, height = 5, 6
|
||||
// )
|
||||
|
@ -11,7 +11,7 @@ import "fmt"
|
||||
|
||||
func main() {
|
||||
var (
|
||||
area int
|
||||
perimeter int
|
||||
width, height = 5, 6
|
||||
)
|
||||
|
||||
@ -20,7 +20,7 @@ func main() {
|
||||
|
||||
// just like in math
|
||||
|
||||
area = 2 * (width + height)
|
||||
perimeter = 2 * (width + height)
|
||||
|
||||
fmt.Println(area)
|
||||
fmt.Println(perimeter)
|
||||
}
|
@ -10,7 +10,7 @@ Now, get your feet wet and try some assignment exercises.
|
||||
|
||||
3. **[Assign With Expressions](https://github.com/inancgumus/learngo/tree/master/06-variables/04-assignment/exercises/03-assign-with-expressions)**
|
||||
|
||||
4. **[Find the Rectangle's Area](https://github.com/inancgumus/learngo/tree/master/06-variables/04-assignment/exercises/04-find-the-rectangle-area)**
|
||||
4. **[Find the Rectangle's Perimeter](https://github.com/inancgumus/learngo/tree/master/06-variables/04-assignment/exercises/04-find-the-rectangle-perimeter)**
|
||||
|
||||
5. **[Multi Assign](https://github.com/inancgumus/learngo/tree/master/06-variables/04-assignment/exercises/05-multi-assign)**
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user