|
三角形问题
public class triangle(){
public boolean islegal(int a,int b,int c){
if((200>=a>0)&&(200>=b>0)&&(200>=c>0)){
return true;
}
else{
return false;
}
}
public boolean isT(int a, int b, int c){
if(a+b>c&&a+c>b&&b+c>a){
return true;
}
else {
return false;
}
}
public void trabc(int a,int b,int c){
if(a=b||a=c||b=c){
System.out.println("isoceles triangle");
}
else if(a=b=c){
Sysetem.out.println("equilateral triangle");
}
else {
Sysetem.out.println("scalene triangle");
}
}
public static void main(String args[]){
if(islegal(4,5,6)){
if(isT(a,4,6)){
trabc(4,5,6);
else{
System.out.println("can not form a triangle");
}
}
}
else {
System.out.println("the inputs numbers are illegimate ");
}
}
} |
|