RIGHT TRIANGLE

I need help with this program because im not sure of the output of this program.

import java.util.*;
import java.io.*;
import java.text.*;


public class RightTriangle{


static Scanner console=new Scanner(System.in);

public static void main(String[] args){




double sh=0.00,sv=0.00,sd=0.00,n=0.00;
String outsd, outn;

System.out.println("Enter number for vertical side");
sv=console.nextDouble();

System.out.println("Enter number for horizontal side");
sh=console.nextDouble();

System.out.println("Enter number for diagonal side");
sd=console.nextDouble();

n=(sh*sh)+(sv*sv);




if(n==(int) Math.round(sd*sd)){

System.out.println("The set of number is a right triangle");

} else {
System.out.println("The set of number is NOT a right triangle");

}


}


}
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories