Files
learngo/06-variables/04-assignment/exercises/04-find-the-rectangle-perimeter/main.go

44 lines
958 B
Go
Raw Normal View History

2018-10-13 23:30:21 +03:00
// For more tutorials: https://blog.learngoprogramming.com
//
// Copyright © 2018 Inanc Gumus
// Learn Go Programming Course
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
//
package main
// ---------------------------------------------------------
2018-11-06 10:13:24 +03:00
// EXERCISE: Find the Rectangle's Perimeter
//
2018-11-06 10:13:24 +03:00
// 1. Find the perimeter of a rectangle
2018-10-13 23:30:21 +03:00
// Its width is 5
// Its height is 6
//
2018-11-06 10:13:24 +03:00
// 2. Assign the result to the `perimeter` variable
2018-10-13 23:30:21 +03:00
//
2018-11-06 10:13:24 +03:00
// 3. Print the `perimeter` variable
2018-10-13 23:30:21 +03:00
//
// HINT
2018-11-13 16:51:04 +03:00
// Formula = 2 times the width and height
2018-10-13 23:30:21 +03:00
//
// EXPECTED OUTPUT
// 22
2018-11-13 16:51:04 +03:00
//
// BONUS
// Find more formulas here and calculate them in new programs
// https://www.mathsisfun.com/area.html
2018-10-13 23:30:21 +03:00
// ---------------------------------------------------------
func main() {
// UNCOMMENT THE CODE BELOW:
2018-10-13 23:30:21 +03:00
// var (
2018-11-06 10:13:24 +03:00
// perimeter int
2018-10-13 23:30:21 +03:00
// width, height = 5, 6
// )
// USE THE VARIABLES ABOVE WHEN CALCULATING YOUR RESULT
// ADD YOUR CODE BELOW
}