Why does an error occur?
If you cant see the triangle with the sides you need to display: "The triangle is not possible."
package com.codegym.task.task04.task0415;
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
String sNumber1 = bufferedReader.readLine();
String sNumber2 = bufferedReader.readLine();
String sNumber3 = bufferedReader.readLine();
int a = Integer.parseInt(sNumber1);
int b = Integer.parseInt(sNumber1);
int c = Integer.parseInt(sNumber1);
if ((a + b) <= c || (a + c) <= b || (b + c) <= a) {
System.out.println("The triangle is not possible.");
}
else{
System.out.println("The triangle is possible.");
}
}
}
package com.codegym.task.task04.task0415;
/*
Rule of the triangle
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
String sNumber1 = bufferedReader.readLine();
String sNumber2 = bufferedReader.readLine();
String sNumber3 = bufferedReader.readLine();
int a = Integer.parseInt(sNumber1);
int b = Integer.parseInt(sNumber1);
int c = Integer.parseInt(sNumber1);
if ((a + b) <= c || (a + c) <= b || (b + c) <= a) {
System.out.println("The triangle is not possible.");
}
else{
System.out.println("The triangle is possible.");
}
}
}