CodeSolved

Solved Programming Questions & Exercises

Review of Hammar's case

Practice Easy 209/ Download 826 Views

Write a program that can check out the 2 -input user in which the triangle can be built with the sides received.

(Triangular Equality: In each triangle, the size of each side is smaller than the other 2 sides)

12 Answers

This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
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")
Feribanoo Download Python
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
روش دوم هستش
Sumy.amiri Download Python
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()
Kasra Download Python
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 ): ")
Hes8am Download Python
def can_form_triangle(a, b, c):
    """بررسی می‌کند که آیا می‌توان مثلثی با اضلاع a، b و c ساخت یا خیر."""
    return (a + b > c) and (a + c > b) and (b + c > a)

if __name__ == "__main__":
    # Get the sides of the triangle from the user
    while True:
        try:
            a = float(input("لطفاً اندازه ضلع اول مثلث را وارد کنید: "))
            b = float(input("لطفاً اندازه ضلع دوم مثلث را وارد کنید: "))
            c = float(input("لطفاً اندازه ضلع سوم مثلث را وارد کنید: "))
            break
        except ValueError:
            print("لطفاً یک عدد صحیح یا اعشاری وارد کنید.")

    # Check whether the triangle can be made or not
    if can_form_triangle(a, b, c):
        print("با این اضلاع می‌توان مثلثی ساخت.")
    else:
        print("با این اضلاع نمی‌توان مثلثی ساخت.")
Mma123 Download Python
# Review of Hammar's case
a=int(input("a: "))
b=int(input("b: "))
c=int(input("c: "))
if (a+b>c) and (a+c>b) and (b+c>a) :
    print("we can make triangle")
else: 
    print("we nca not make triangle")
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")
User 2140 Download Python
<< Previous page 1 2 Next page >>

Submit answer

Submitting answers is currently unavailable.

×
×
Close