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.

In the figure bellow is shown a trapezoid with bases 8 and 13 and height 7. It has an area (8 + 13) * 7 / 2 = 73.5.

Hints and Guideliness

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 with [Ctrl+F5] and enter an examplary data.

Testing in the Judge System

Test your solution here:

results matching ""

    No results matching ""