Triangle Height
Time limit1sMemory limit1024 MB
Given several triangle areas and base lengths, the task prints each triangle's height to two decimal places using h = 2a / b.
- Level
Easy1 of 10
- Topics
- Implementation, Math
- Solved
- No attempts yet
Problem
Your math teacher asked you to write a program that helps him generate homework solutions. The program must find the height of a triangle from its area and base length.
The formula is:
Here is the area, is the base length, and is the height.
Input
The first line contains a single integer , the number of lines that follow. Each line contains the area and base length of a triangle, separated by a single space.
area base
Output
For each input, print the height of the triangle with 2 decimal places in the following format:
The height of the triangle is #.## units