Problem: triangle area

Write a program that reads from the console a side and a height of a triangle and calculates its area. Use the formula for triangle area: area = a * h / 2. Round the result to 2 digits after the decimal separator using Math.Round(area, 2).

Sample Input and Output

Input Output
20
30
Triangle area = 300
15
35
Triangle area = 262.5
7.75
8.45
Triangle area = 32.74
1.23456
4.56789
Triangle area = 2.82

Testing in the Judge System

Test your solution here: https://judge.softuni.bg/Contests/Practice/Index/504#7.

results matching ""

    No results matching ""