logo image

Go language program to calculate parallelogram area

Views: 12

Fallowing program shows you how to calculate parallelogram area. This program gets parallelogram base and height from user and calculates area and prints it using following formula Area = base X height

package main

import "fmt"

func main() {

  var parallelogramBase float64
  var parallelogramHeight float64
  var areaOfParallelogram float64
  fmt.Println("Please enter base of parallelogram:")
  fmt.Scanf("%f", &parallelogramBase)
  fmt.Println("Please enter height of parallelogram:")
  fmt.Scanf("%f", &parallelogramHeight)
  areaOfParallelogram = parallelogramBase * parallelogramHeight
  fmt.Println("Area of parallelogram is: " , areaOfParallelogram)


Please enter base of parallelogram:
Please enter height of parallelogram:
Area of parallelogram is:  180
We are looking for Interns!
Send your resumes to
[email protected]