Mode Gelap

Recent in Fashion

Best Seller Books

Input and Output Statement Area of Triangle 1311110094

Write a program in java to find the Area of a triangle.

First you create a method for calculating the area.
Read or get the value of base width and height of  triangle from user.
then calculate the area of triangle and then print the triangle value.
Area of Triangle = (base width * height)/2

Note: input values may have decimal values
          output values should print with decimal values.

Sample Input

5 7

Sample Output

Base Width: 5.0
Enter Height: 7.0
Area of Triangle: 17

12
4
Base Width: 12.0
Height: 4.0
Area of Triangle: 24.0
5.5
20.2
Base Width: 5.5
Height: 20.2
Area of Triangle: 55.55
15 17
Base Width: 15.0
Height: 17.0
Area of Triangle: 127.5
12.50
24.9
Base Width: 12.5
Height: 24.9
Area of Triangle: 155.625
 

Subscribe Our Newsletter

avatar
"By speaking behind my back, it means that you respect my existence enough not to act in front of my face."

Related Posts

1 Komentar

  1. import java.io.*;
    import java.util.Scanner;
    public class TestClass {
    public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    double b,h,area;
    b = sc.nextDouble();
    h = sc.nextDouble();
    area = (b*h)/2;
    System.out.println("Base Width: " + b);
    System.out.println("Height: " + h);
    System.out.println("Area of Triangle: "+area);
    }
    }

    ReplyDelete

Article Top Ads

Parallax Ads

Article Center Ads

Article Bottom Ads