例3-3
import java.util.*;
public class Example3_3 {
public static void main (String args[]){
Scanner reader=new Scanner(System.in);
double a=0,b=0,c=0;
System.out.print("input a:");
a=reader.nextDouble();
System.out.print("input b:");
b=reader.nextDouble();
System.out.print("input c:");
c=reader.nextDouble();
if(a+b>c&&a+c>b&&b+c>a){
if(a*a==b*b+c*c||b*b==a*a+c*c||c*c==a*a+b*b){
System.out.printf("%-8.3f%-8.3f%-8.3f make up right triangle",a,b,c);
}
else if (a*a<b*b+c*c&&b*b<a*a+c*c&&c*c<a*a+b*b){
System.out.printf("%-8.3f%-8.3f%-8.3f make up shape triangle",a,b,c);
}
else{
System.out.printf("%-8.3f%-8.3f%-8.3f make up obtuse triangle",a,b,c);
}
}
else{
System.out.printf("%f,%f,%f cannot make up triangle");
}
}
}