package com.lyvust.Melirn;
import java.util.Scanner;
/**
* author:Melirn 2227287556@qq.com
* date:2021.4.15
*/
public class triangle {
public void judge(int a , int b, int c){
if (a+b>c&&a+c>b&&b+c>a){
System.out.println("这是一个三角形");
}
else {
System.out.println("这不是一个三角形");
}
}
public void shape(int a , int b, int c){
if (a==b||b==c||a==c){
System.out.println("等腰三角形");
}
else if (a==b&&b==c){
System.out.println("等边三角形");
}
else if ((a*a)+(b*b)==(c*c)||(c*c)+(b*b)==(a*a)||(c*c)+(a*a)==(b*b)){
System.out.println("直角三角形");
}
else if ((a*a)+(b*b)<(c*c)||(c*c)+(b*b)<(a*a)||(c*c)+(a*a)<(b*b)){
System.out.println("钝角三角形");
}
else if ((a*a)+(b*b)>(c*c)||(c*c)+(b*b)>(a*a)||(c*c)+(a*a)>(b*b)){
System.out.println("锐角三角形");
}
}
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("请输入三角形的三边");
int a = input.nextInt();
int b = input.nextInt();
int c = input.nextInt();
triangle test = new triangle();
test.judge(a,b,c);
test.shape(a,b,c);
}
}
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交