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

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

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

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

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

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

reply 15

visibility
a = int(input("enter your number:"))
b = int(input("enter your number:"))
c = int(input("enetr your number:"))
if a + b > c or a + c > b or b + c > a:
    print("mosallas nist")
else:
    print("mollass mibashad")
X=float(input("x:"))
Y=float(input("y:"))
H=float(input("h:"))
if X<Y+H and Y<X+H and H<X+Y:
    print("قضیه حمار برقرار است")
else:
    print("نمی توان با این اعداد مثلثی ساخت")
x1=int(input("print your x1: "))
x2=int(input("print your x2: "))
x3=int(input("print your x3: "))
if x1+x2>x3 and x2+x3>x1 and x3+x1>x2:
    print("True")
else:
    print("False")
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 بنویس و ثبت کن

×
بستن