WAP to calculate and display the hypotenuse of a right-angled triangle by
taking perpendicular and base as inputs.
Answers
Answered by
3
Answer:
import java.util.*;
class rightangletraingle
{
public static void main (String args[ ])
{
Scanner sc=new Scanner(System.in);
double h,b,p;
System.out.println(" Enter the Perpendicular and Base ");
b=sc.nextDouble();
p=sc.nextDouble();
h=Math.sqrt(b*b+p*p);
System.out.println("Hypotenuse:-" +h);
}
}
Similar questions