74
print(“Birinchi son katta=”, (a+b)/2)
6 topshiriq.
Ikkita haqiqiy son berilgan. Bu
sonlarning kichigini yarim
yig‘indisi bilan, kattasini esa ko‘paytmasi bilan almashtiring.
Python dasturi:
print(“Ikkita haqiqiy son kiriting”)
from math import *
a=float (input(“a=”))
b=float (input(“b=”))
if a>b:
print(“Kichik son b=”, (a/2+b/2))
print(“Katta son a=”, (a*b))
else:
print(“Kichik son a=”, (a/2+b/2))
print(“Katta son b=”, (a*b))
Ikkita haqiqiy son kiriting
a=9
b=5
Kichik son b = 7.0
Katta son a = 45.0
7 topshiriq.
Uchta o‘zaro har xil sonlarning yig‘indisi birdan kichik bo‘lsa,
berilgan sonlarning eng kichigi, aks holda eng kattasi topilsin.
Python dasturi:
print(“Uchta haqiqiy son kiriting”)
from math import *
a=float(input(“a=”))
b=float(input(“b=”))
c=float(input(“c=”))
if a!=b and b!=c and a!=c:
k=min(a,b,c)
print(“Kichik son =”, k)
else:
Uchta haqiqiy son kiriting
a=6
b=8
b=9
Kichik son = 6.0