From f4068b8a4707284046d532f341730e16c1207933 Mon Sep 17 00:00:00 2001 From: Ritish Srivastava <121374890+Ritish134@users.noreply.github.com> Date: Sat, 7 Oct 2023 08:43:28 +0530 Subject: [PATCH] Created v5cgZN.go Created Go program for finding area of parallelogram . closes #1554 Signed-off-by: Ritish Srivastava <121374890+Ritish134@users.noreply.github.com> --- HjOamA/v5cgZN.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 HjOamA/v5cgZN.go diff --git a/HjOamA/v5cgZN.go b/HjOamA/v5cgZN.go new file mode 100644 index 0000000..5c4ca65 --- /dev/null +++ b/HjOamA/v5cgZN.go @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" +) + +func parallelogramArea(base, height float64) float64 { + return base * height +} + +func main() { + var base, height float64 + + // Get user input for base and height + fmt.Print("Enter the base of the parallelogram: ") + fmt.Scan(&base) + + fmt.Print("Enter the height of the parallelogram: ") + fmt.Scan(&height) + + // Calculate the area + area := parallelogramArea(base, height) + + // Display the result + fmt.Printf("The area of the parallelogram with base %.2f and height %.2f is %.2f\n", base, height, area) +}