Triangle area
Write a program that receives the rule and height of the triangle and calculates its area
Triangle area = (rule * height) divided by 2
Write a program that receives the rule and height of the triangle and calculates its area
Triangle area = (rule * height) divided by 2
let msg = 'error' alert(msg)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
let msg = 'error' alert(msg)This answer is only visible to premium members
This answer is only visible to premium members
X=float(input("x: ")) H=float(input("y: ")) print("s:",X*H/2)X=float(input("x: "))
There is an extra part of the end of the code that should be erased
def calculate_triangle_area(base, height): return (base * height) / 2 def main(): try: base = float(input("لطفاً قاعده مثلث را وارد کنید: ")) height = float(input("لطفاً ارتفاع مثلث را وارد کنید: ")) area = calculate_triangle_area(base, height) print(f"مساحت مثلث برابر است با: {area}") except ValueError: print("لطفاً یک عدد معتبر وارد کنید.") if __name__ == "__main__": main()
g = int(input("ghaede ye mosalas ra vared konid: "))
e = int(input("ertefa ye mosalas ra vared konid: "))
print(g*e/2)
x = float(input("inter x :")) y = float(input("inter y :")) a = (x * y) /2 print(a)
def mosallas(ghaedeh,ertefah): masahat = (ghaedeh * ertefah) / 2 return masahat print(mosallas(ghaedeh=int(input("enter your numnber:")),ertefah=int(input("enter your number:"))))
a = int(input('قاعده'))
b = int(input("ارتفاع"))
c = a * b
print (c / 2)
x=int(input('qaedemorede nazar ra vared konid? \t')) y=int(input('ertefa ra vared konid? \t')) print((x*y)//2)
Submitting answers is currently unavailable.
You must be logged in to access this section.
Login/Sign up If you don’t understand the exercise or can’t solve it for any reason, that’s completely
normal—don’t worry 😊
Try checking out easier exercises and reviewing different answers
submitted by others. Gradually, you can move on to more challenging exercises. Also, your answer
might be correct even if it’s different from others.