Go language program to calculate parallelogram circumference

Views: 142   

Following program shows you how to calculate parallelogram circumference.
This program gets parallelogram base and side from user and calculates circumference and prints it using following formula
Circumference = 2 X base X side

package main

import "fmt"

func main() {

  var parallelogramBase float64
  var parallelogramSide float64
  var circumferenceOfParallelogram float64
  fmt.Println("Please enter base of parallelogram:")
  fmt.Scanf("%f", &parallelogramBase)
  fmt.Println("Please enter side of parallelogram:")
  fmt.Scanf("%f", &parallelogramSide)
  circumferenceOfParallelogram = 2 * (parallelogramBase + parallelogramSide)
  fmt.Println("Circumference of parallelogram is: " , circumferenceOfParallelogram)


Please enter base of parallelogram:
Please enter side of parallelogram:
Circumference of parallelogram is:  110
On By