Exercise 4 2
import java.util.Scanner;
import java.util.InputMismatchException;
 
public class exercise_4_2    
{
 
    public static void isTriangle(int a, int b, int c){
        if (a >= b+c || b >= a+c || c >= a+b){
            System.out.println("it is not a triagle!!!!");
        }else{
            System.out.println("is a triagle!!! :)");
        }
    } 
 
    public static void main(String [] args) {
 
        Scanner sc1 = new Scanner(System.in);
        System.out.println("input a length");
        int a = sc1.nextInt();
        Scanner sc2 = new Scanner(System.in);
        System.out.println("input b length");
        int b = sc2.nextInt();
        Scanner sc3 = new Scanner(System.in);
        System.out.println("input c length");
        int c = sc3.nextInt();
        isTriangle(a,b,c);
    }
}

voltar

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.