Question: Write a program that takes the lengths of the three sides of a triangle as inputs. The program should display whether or not the triangle
Write a program that takes the lengths of the three sides of a triangle as inputs. The program should display whether or not the triangle is a right triangle. Do not assume that the side lengths are entered in any particular order. You need to check and see which side is the longest. The code is to be written in JAVA.
import java.util.Scanner;
public class Main {
public static void main (String[] args) {
Scanner scanner= new Scanner(System.in);
{
side1 = a;
side2 = b;
side3 = c;
}
{
{boolean is right = true;
if (((a*a) == ((b*b) + (c*c))) ||
((b*b) == ((a*a) + (c*c))) ||
((c*c) == ((a*a) + (b*b))));
else
return false;}
I am getting the following error, and could someone also please point out if I'm answering the question correctly.
Main.java:16: error: reached end of file while parsing return false;}} ^ 1 error
I know this means I am missing a curly, but I am not sure where.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
