Problem: Trapezoid Area

Write a program that reads three numbers from the console b1, b2 and h and calculates the area of a trapezoid with bases b1 and b2 and height h. The formula for trapezoid area is (b1 + b2) * h / 2.

The figure below shows a trapezoid with bases 8 and 13 and height 7. It has an area (8 + 13) * 7 / 2 = 73.5.

Hints and Guidelines

Again, we have to add to the existing Visual Studio solution another console C# project with name "Trapezoid-Area" and write the code that reads the input from the console, calculates the trapezoid area and prints it:

The code in the picture is purposely blurred, in order for you to give it a thought and finish it yourself.

Test your solution locally using [Ctrl+F5] and enter an exemplary data.

Testing in the Judge System

Test your solution here: https://judge.softuni.org/Contests/Practice/Index/504#4.

results matching ""

    No results matching ""