```
import java.util.Scanner;
public class Exercise3_1 {
public static void main (String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter three edges: ");
int integer = input.nextInt();
int edge1 = 1;
int edge2 = 1;
int edge3 = 1;
// First condition: edge1 + edge2 should be greater than or equal to edge3
boolean triangle = (edge1 + edge2 >= edge3);
// Second condition: edge1 + edge3 should be greater than edge2
triangle =!(triangle && (edge1 + edge3 > edge2));
// Third condition: edge2 + edge3 should be greater than edge1
triangle =!(triangle && (edge2 + edge3 > edge1));
System.out.println("Can edges " + edge1 + ", " + edge2 + "," + " " + "and " + edge3 + " form a triangle? " + triangle);
}
}
```

## Recommended Answers

Jump to PostPlease explain what the problem is.

Show the program's output and explain what is wrong with it and show what you want the output to be.

Jump to PostCan you show Exactly what the program outputs

and then show exactly what you want the output to be

instead of writing it as a paragraph with wrapping lines etc?

Jump to PostHere is what I get when I execute the code:

Enter three edges: 111

Can edges 1, 1, and 1 form a triangle? true

## All 11 Replies

NormR1
563
Posting Sage
Team Colleague

PearlLV88
0
Newbie Poster

NormR1
563
Posting Sage
Team Colleague

NormR1
563
Posting Sage
Team Colleague

PearlLV88
0
Newbie Poster

PearlLV88
0
Newbie Poster

NormR1
563
Posting Sage
Team Colleague

PearlLV88
0
Newbie Poster

NormR1
563
Posting Sage
Team Colleague

PearlLV88
0
Newbie Poster

NormR1
563
Posting Sage
Team Colleague

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.