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);
}
}
PearlLV88 0 Newbie Poster
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 developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.