حالت آفلاین — محتوا از حافظهٔ کش نمایش داده می‌شود

بررسی قضیه حمار

تمرین آسان 1432 visibility link download flag

برنامه ای بنویسید که با گرفتن ۳ ورودی ار کاربر بررسی کند که با توجه به قضیه حمار میتوان مثلثی با ضلع های دریافت شده ساخت یا خیر؟

(قضیه حمار یا نابرابری مثلثی: در هر مثلث اندازه هر ضلع از مجموع ۲ ضلع دیگر کوچکتر است)

👨‍💻 20 ساعت قبل کاربر ناشناس این تمرین رو مشاهده کرد

reply 15

visibility

برای مشاهده این جواب باید اشتراک داشته باشی

دریافت اشتراک

جواب شماره 1072

برای مشاهده این جواب باید اشتراک داشته باشی

دریافت اشتراک

جواب شماره 623

برای مشاهده این جواب باید اشتراک داشته باشی

دریافت اشتراک

جواب شماره 2749

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")
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")
def hemar(a , b , c):
    if a < b + c and b < a + c and c < a + b:
        return "You can make a triangle with these values."
    else:
        return "You can't make a triangle with these values."
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()
<< صفحه قبل 1 2 صفحه بعد >>

ارسال جواب

جوابت را با Markdown بنویس و ثبت کن

×
بستن