1.

Write a program to Java to accept or assign perpendicular and base of right angle triangle calculate the display the area of triangle area of triangle =half * perpendicular *base using scanner class

Answer»

ANSWER:

import java.util.*;

public class MAIN

{

public static void main(STRING[] args) {

    Scanner sc=new Scanner(System.in);

       INT perpendicular=sc.nextInt();

       int base=sc.nextInt();

     int area=(perpendicular*base)/2;

     

     System.out.println("Area of triangle= "+area);

             

           

}

}

Explanation:



Discussion

No Comment Found