求大佬编程(有赏)(求源代码)
24.def check(a,b,c):
int(a);int(b);int(c)
if a + b > c and a + c > b and c + b > a:
print("能够成为三角形")
if a == b == c:
print("该三角形为等边三角形")
elif a == b or b == c or a == c:
print("该三角形为等腰三角形")
elif a*a + b*b == c*c or a*a + c*c == b*b orb*b + c*c == a*a:
print("该三角形为直角三角形")
else:
print("三边长不构成三角形")
a = input("三角形第一条边:")
b = input("三角形第二条边:")
c = input("三角形第三条边:")
check(a,b,c)
25.
def lcm(a,b):
for i in range(min(a,b),0,-1):
if a % i == 0 and b % i == 0:
return a*b//i
def hcf(a,b):
for i in range(min(a,b),0,-1):
if a % i == 0 and b % i == 0:
return i
break
num1 = int(input("请输入第一个整数:"))
num2 = int(input("请输入第二个整数:"))
answer1 = lcm(num1,num2)
answer2 = hcf(num1,num2)
print("最小公倍数为:",answer1,"\n最大公约数为:",answer2)
hhjdsd 发表于 2021-1-9 20:36
24.
25.
大佬,我还有几道题可以尝试一下哦
页:
[1]