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

بررسی رابطه فیثاغورس

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

برنامه ای بنویسید که اندازه ۳ ضلع مثلث را بگیرد و بررسی کند که رابطه فیثاغورس در مثلث برقرار است (مثلث قائم الزاویه است) یا خیر؟ در صورت برقرار بودن، ضلغ وتر را نیز مشخص کند

رابطه فیثاغورس: (ضلغ به توان 2) + (ضلغ به توان 2) = (وتر به توان 2)

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

پاسخ‌ها 18

a=int(input("Enter the legth of the side of the triangle:"))
b=int(input("Enter the second length of the side of the triangle: "))
c=int(input("Enter the length of the VATAR:"))
d=("the triangle has a 90 degrees angle & c is vatar")
if c**2==(b**2)+(a**2):
    print(d)
else:
    print("the triangle does not have a 90 degrees angle")
x = float(input("enter x :"))
y = float(input("enter y :"))
z = float(input("enter z :"))
if z**2 == y**2 + x**2 or x**2 == y**2 + z**2 or y**2 == x**2 + z**2:
    print("It's a right-angled triangle")    # مثلث  قائمه زاویه است
    if z**2 == y**2 + x**2:
        print("z = hypotenuse")     # وتر است z
    elif x**2 == y**2 + z**2:
        print("x = hypotenuse")     # وتر استx
    elif y**2 == x**2 + z**2:
        print("y = hypotenuse")     # وتر استy
else :
    print("It's not a right-angled triangle")   #مثلث  قائمه زاویه نیست
def check_right_triangle(a, b, c):
    sides = sorted([a, b, c])
    if sides[0]**2 + sides[1]**2 == sides[2]**2:
        return f"مثلث قائم الزاویه است و وتر: {sides[2]} است."
    else:
        return "مثلث قائم الزاویه نیست."

# ورودی از کاربر
a = float(input("ضلع اول را وارد کنید: "))
b = float(input("ضلع دوم را وارد کنید: "))
c = float(input("ضلع سوم را وارد کنید: "))

result = check_right_triangle(a, b, c)
print(result)
پاسخ هوش مصنوعی Ai Python
def math():
	a=int(input("ضلع اول را وارد کن"))
	b=int(input("ضلع دوم را وارد کن"))
	c=int(input("وتر را وارد کن"))
	
	if a**2+b**2==c**2:
		print("بله")
	else:
		print("نه")
math()
a=int(input('please enter your number(vatare):'))
b=int(input('please enter your number:'))
c=int(input('please enter your number:'))
if a**2==b**2+c**2:
    print('this triangle is a right triangle')
else:
    print('this triangle is not a right triangle')
a=float(input('input first side of triangle:'))
b=float(input('input second side of triangle:'))
c=float(input('input third side of triangle:'))
if a**2+b**2==c**2:
    print('right triangle')
else:
    print('its not right triangle')
def Fisaghoores():
    num_1 = int(input('Enter first number :  '))
    num_2 = int(input('Enter second number : '))
    num_3 = int(input('Enter third number : '))
    if (num_1**2)+(num_2**2) == (num_3**2):
        print('The numbers are Fisaghoores ! ')
    else:
        print('This numbers are not Fisaghoores')
# (بعد از انجام اولین بار)برای اینکه آیا بازم میخواد اجرا بشه یا نه
Fisaghoores()
feedback = input('If you like to run again, enter yes or you do not like, enter no :')
if feedback == 'yes':
    Fisaghoores()
elif feedback == 'no':
    print('Bye')
else : 
    print(f'{feedback}is not defined ! please try again later.')
a=int(input("a: "))
b=int(input("b: "))
c=int(input("c: "))
if a**2==b**2+c**2 :
    print("HAST", "VATAR:",a)
elif b**2==a**2+c**2:
    print("HAST", "VATAR:",b)
elif c**2==b**2+a**2:
    print("HAST", "vatar:",c)
else:
    print("NIST")

ارسال جواب

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

×
بستن