Advertisement
kamandos

HW3

Jun 26th, 2022
998
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.47 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. class Main {
  4.    public static void main(String args[]) {  
  5.       Scanner scanner = new Scanner(System.in);
  6.  
  7.       System.out.println("Enter the width: ");
  8.       double base = scanner.nextDouble();
  9.  
  10.       System.out.println("Enter the height: ");
  11.       double height = scanner.nextDouble();
  12.  
  13.       //Area = (width*height)/2
  14.       double area = (base* height)/2;
  15.       System.out.println("Area of Triangle is: " + area);      
  16.    }
  17.    
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement