返回列表 發帖
package jihgh;

import java.util.Scanner;

public class dbxdbff {
        static Scanner k = new Scanner(System.in);
   
        
        public static void main(String[] args) {
                // TODO 自動產生的方法 Stub

                test();        
        test();
        test();
        test();
        }

        private static void test() {
                System.out.print("請輸入三個數字");
                int a=k.nextInt();
                int b=k.nextInt();
                int c=k.nextInt();
     if(a+b>c && a+c>b && b+c>a)
     {
                if(a*a+b*b==c*c || c*c+a*a==b*b || c*c+b*b==a*a)
                {
                        System.out.println("直角三角形");
                }
                else if(a*a+b*b<c*c || c*c+a*a<b*b || c*c+b*b<a*a)
                {
                        System.out.println("頓角三角形");
                }
                else
                {
                        System.out.println("瑞角三角形");
                }
               
     }
     else
     {
             System.out.print("不可構成三角形");
     }
        }

}

TOP

返回列表