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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!