Computer Science, asked by Anonymous, 7 months ago

write a program to accept perpendicular and base of right angle triangle through scanner class. calculate and display hypertenuse, area and perimeter of the triangle.

Answers

Answered by abhisheksinghr59
8

Answer:

Java Area of a Right Angled Triangle

If we know the width and height then, we can calculate the area of a right angled triangle using the below formula. Area = (1/2) * width * height

Using Pythagoras formula, we can easily find the unknown sides in the right angled triangle. c² = a² + b²

The perimeter of a Right Angled Triangle is the distance around the edges. We can calculate the perimeter using the below formula. Perimeter = a + b+ c

Java Program to find Area of a Right Angled Triangle Example

This Java program allows the user to enter the width and height of the right angled triangle. Using those values, we will calculate the Area and perimeter of the right angled triangle.

Explanation:

plzz mark me as a brainliest

Answered by da4729204
28

Answer:

import java.util.Scanner;

public class Sample{

public static void main(String[] args){

Scanner scan = new Scanner(System.in);

System.out.print("Enter perpendicular height of right angled triangle : ");

double height = scan.nextDouble();

System.out.print("\nEnter base of right angled triangle : ");

double base = scan.nextDouble();

double hypotenuse = Math.sqrt((height*height) + (base * base));

System.out.println("\nHypotenuse of right angled triangle is "+ hypotenuse);

}}

Similar questions