White a JAVA program to print out a triangle and calculate the area of the triangle based on the number of asterisks used | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

White a JAVA program to print out a triangle and calculate the area of the triangle based on the number of asterisks used

Java

9th Aug 2017, 12:07 AM
Theophane Chukwunweike Amadi
Theophane Chukwunweike Amadi - avatar
3 Answers
+ 2
If the program is the one printing the thing, doesn't it have access to the sizes anyways?
9th Aug 2017, 12:11 AM
Jordan Chapman
Jordan Chapman - avatar
+ 2
(Base*Height) / 2 Should be all you need.
9th Aug 2017, 12:18 AM
Rrestoring faith
Rrestoring faith - avatar
0
The height and base of the triangle is dependent on the number of asterisks, the program has to print the asterisks in a triangle form before calculating the area. Thanks @RrestoringFaith @JordanChapman
10th Aug 2017, 3:47 PM
Theophane Chukwunweike Amadi
Theophane Chukwunweike Amadi - avatar