Home > Back-end >  How to use a JAVA implementation of triangle area calculation.
How to use a JAVA implementation of triangle area calculation.

Time:09-23

Such as topic, how to use a JAVA implementation of triangle area calculation, high marks, need thought and method, easy to understand way! Throw out all the points, low don't answer,
Satisfaction after 20

CodePudding user response:


refer to the building of a computer "small white" reply:
such as topic, how to use a JAVA implementation of triangle area calculation, high marks, need thought and method, easy to understand way! Throw out all the points, low don't answer,
Satisfaction after 20

I have a question you say is ordinary triangle calculation? Base times height/2??? If yes then bottom and high receiving from the keyboard, and then in 2,


CodePudding user response:

import java.io.BufferedReader;
import java.io.InputStreamReader;

Public class triangle area {

Public static void main (String [] age) throws the Exception {
BufferedReader reader=new BufferedReader (new InputStreamReader (System. In));
String=l reader. ReadLine ();
String h=reader. ReadLine ();
Int a=Integer. ParseInt (l);
Int b=Integer. ParseInt (h);
Int s=a * b/2;
System. The out. Println (" the area of a triangle is: "+ s);

}

}
No test, your own measure
  • Related