45 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			45 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| // Copyright © 2018 Inanc Gumus
 | |
| // Learn Go Programming Course
 | |
| // License: https://creativecommons.org/licenses/by-nc-sa/4.0/
 | |
| //
 | |
| // For more tutorials  : https://learngoprogramming.com
 | |
| // In-person training  : https://www.linkedin.com/in/inancgumus/
 | |
| // Follow me on twitter: https://twitter.com/inancgumus
 | |
| 
 | |
| package main
 | |
| 
 | |
| // ---------------------------------------------------------
 | |
| // EXERCISE: Find the Rectangle's Perimeter
 | |
| //
 | |
| //  1. Find the perimeter of a rectangle
 | |
| //     Its width is  5
 | |
| //     Its height is 6
 | |
| //
 | |
| //  2. Assign the result to the `perimeter` variable
 | |
| //
 | |
| //  3. Print the `perimeter` variable
 | |
| //
 | |
| // HINT
 | |
| //  Formula = 2 times the width and height
 | |
| //
 | |
| // EXPECTED OUTPUT
 | |
| //  22
 | |
| //
 | |
| // BONUS
 | |
| //  Find more formulas here and calculate them in new programs
 | |
| //  https://www.mathsisfun.com/area.html
 | |
| // ---------------------------------------------------------
 | |
| 
 | |
| func main() {
 | |
| 	// UNCOMMENT THE CODE BELOW:
 | |
| 
 | |
| 	// var (
 | |
| 	// 	perimeter        int
 | |
| 	// 	width, height = 5, 6
 | |
| 	// )
 | |
| 
 | |
| 	// USE THE VARIABLES ABOVE WHEN CALCULATING YOUR RESULT
 | |
| 
 | |
| 	// ADD YOUR CODE BELOW
 | |
| }
 |