java等腰三角形代碼 java從鍵盤輸入三角形的三條邊,判斷它們能否構(gòu)成三角形。若能構(gòu)成三角形,指出是何種三角形?
java從鍵盤輸入三角形的三條邊,判斷它們能否構(gòu)成三角形。若能構(gòu)成三角形,指出是何種三角形?回答:包com導(dǎo)入java.util.Scanner文件public class W{public stat
java從鍵盤輸入三角形的三條邊,判斷它們能否構(gòu)成三角形。若能構(gòu)成三角形,指出是何種三角形?
回答:包com
導(dǎo)入java.util.Scanner文件
public class W
{
public static void main(String[]args){系統(tǒng)輸出打印“請輸入=新掃描儀”(“三面”)(系統(tǒng)輸入)
字符串位置1=sc.下一個()
字符串[]location1s=location1.split(“,”)
int x1=整數(shù).parseInt(位置1s[0])
int y1=整數(shù).parseInt(位置1s[1])
int z1=整數(shù).parseInt(location1s[2])
如果((x1 y1>z1)&&(x1 z1>y1)&&(y1 z1>x1)){系統(tǒng)輸出打?。ā翱梢孕纬扇切危保﹠否則{系統(tǒng)輸出打印(“不能形成三角形)”)}