بررسی قضیه حمار
برنامه ای بنویسید که با گرفتن ۳ ورودی ار کاربر بررسی کند که با توجه به قضیه حمار میتوان مثلثی با ضلع های دریافت شده ساخت یا خیر؟
(قضیه حمار یا نابرابری مثلثی: در هر مثلث اندازه هر ضلع از مجموع ۲ ضلع دیگر کوچکتر است)
برنامه ای بنویسید که با گرفتن ۳ ورودی ار کاربر بررسی کند که با توجه به قضیه حمار میتوان مثلثی با ضلع های دریافت شده ساخت یا خیر؟
(قضیه حمار یا نابرابری مثلثی: در هر مثلث اندازه هر ضلع از مجموع ۲ ضلع دیگر کوچکتر است)
let msg = 'error' alert(msg)این جواب فقط برای مشترکین ویژه قابل مشاهده است
برای مشاهده این جواب باید اشتراک داشته باشی
دریافت اشتراکlet msg = 'error' alert(msg)این جواب فقط برای مشترکین ویژه قابل مشاهده است
برای مشاهده این جواب باید اشتراک داشته باشی
دریافت اشتراکlet msg = 'error' alert(msg)این جواب فقط برای مشترکین ویژه قابل مشاهده است
برای مشاهده این جواب باید اشتراک داشته باشی
دریافت اشتراکfS=str(input("enter the first side:"))
sS=str(input("enter the secend side"))
tS=str(input("enter the third side"))
if (fs+sS)>tS and (fS+tS)>sS and (sS+tS)>fS:
print("you can make a triangle with these sides")
else:
print("you cant make a triangle with these sides")
a = int(input('num1: '))
b = int(input('num2: '))
c = int(input('num3: '))
if a < b + c and b < a + c and c < a + b:
print('YES')
else:
print('NO')
def Hemar(x,y,z):
if x + y > z or y + z > x or x + z > y:
print("I can construct a triangle with sides")
else:
print("I can not construct a triangle with sides")
while True:
number1 = int(input("enter the first side :"))
number2 = int(input("enter the second side :"))
number3 = int(input("enter the third side :"))
Hemar(number1,number2,number3)
a=int(input("Enter a number: "))
b=int(input("Enter another number: "))
c=int(input("Enter a third number: "))
if a+b>c:
print("true")
elif a+c>b:
print("true")
elif b+c>a:
print("true")
elif c+a>b:
print("true")
else:
print("false")
import time
strat_time = time.time()
while True:
a = int(input("enter your number a:"))
if a == 0:
print("finish")
break
b = int(input("enter your number b:"))
c = int(input("enter your number c:"))
if a < b + c or b < a + c or c < a + b:
print("homar bargharar ast")
if a == b == c:
print("not homar")
if time.time() - strat_time > 7:
print("time is over")
break
روش دوم هستش
def hemar():
it_s_hemar = False
a,b,c = eval(input("enter a ,b ,c: "))
if (a + b > c) and (a + c > b) and (b + c > a):
it_s_hemar = True
print(it_s_hemar)
else:
print("these three numbers connot make a triangle!!")
hemar()
a =int(input("pls enter the first number;....." ))
b = int(input("pls second number :) ...."))
c = int(input("pls and the last number...."))
if a < b+c and b< a+c and c< a+b :
print("great! The inserted sides are without problems/..")
else:
print("sorry, you can't make triangle ): ")
برای استفاده از این بخش باید وارد حساب کاربریت بشی
ورود/ثبت نام