正在加载图片...
Java程序 import java. util class hu i int a, b, C; void judged I Scanner in=new Scanner(System. in) System. out. println(“ Please enter a,b,c:”) a=in. nextlnto; b=in. nextlnto; c=in nextinto if(a<o b<olIc<0)System. out. println("Error input! ); else if(a+b<=c b+c<=aa+c<=b) System. out printin(not a triangle!") else if(a==b & b==c & a==c) System. out printIn(equilateral triangle! ); else if(a==b l b==c a==c)System. out printIn( isosceles triangle) else System. out. printIn(only a triangle!): public class triangle public static void main(string l args)t Hu che =new Hu(; che. judge:]+Java程序 import java.util.*; class Hu { int a,b,c; void judge() { Scanner in=new Scanner(System.in); System.out.println(“Please enter a,b,c:”); a=in.nextInt();b=in.nextInt();c=in.nextInt(); if(a<0||b<0||c<0) System.out.println(“Error input!”); else if(a+b<=c || b+c<=a || a+c<=b) System.out.println(“not a triangle!”); else if(a==b && b==c && a==c) System.out.println(“equilateral triangle!”); else if(a==b || b==c || a==c) System.out.println(“isosceles triangle!”); else System.out.println(“only a triangle!”);} } public class triangle{ public static void main(String[] args) { Hu che =new Hu(); che.judge();} } a b c
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有