Not sure why I'm failing on the last requirement: display "The triangle is not possible". I've tried several times and can't seem to figure it out. Any suggestions? Thanks in advance.
package com.codegym.task.task04.task0415;
/*
Rule of the triangle
*/
import java.io.*;
import java.util.Scanner;
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
Scanner input = new Scanner(System.in);
int numsForTriangle1 = input.nextInt();
int numsForTriangle2 = input.nextInt();
int numsForTriangle3 = input.nextInt();
canItExist(numsForTriangle1, numsForTriangle2, numsForTriangle3);
}
public static void canItExist(int a, int b, int c) {
if((a + b)>c || (a + c)>b || (b + c)>a)
System.out.println("The triangle is possible.");
else
System.out.println("The triangle is not possible");
}
}