Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- System.out.print("Enter the first side: ");
- double b1 = Double.parseDouble(scanner.nextLine());
- System.out.print("Enter the second side: ");
- double b2 = Double.parseDouble(scanner.nextLine());
- System.out.print("Enter the height: ");
- double h = Double.parseDouble(scanner.nextLine());
- double area = (b1+b2)*h/2.0;
- System.out.println("Trapezoid area: " + area + "cm2");
- }
- }
Add Comment
Please, Sign In to add comment