Python dasturlash tilida
# Function to solve a system of two linear equations
def tenglamalar_sistemasini_yechish (a1, b1, c1, a2, b2, c2):
determinant = a1 * b2 - a2 * b1
if determinant == 0:
print("Sistema yagona yechimga ega emas(Yoki cheksz ko'p yechimga ega).")
else:
x = (c1 * b2 - c2 * b1) / determinant
y = (a1 * c2 - a2 * c1) / determinant
print("\nJavob: x =", x, ", y =", y)
# Get 1- tenglama keoffitsientlarini kiriting (a1x + b1y = c1)
a1 = float(input("a1 ni kiriting: "))
b1 = float(input("b1 ni kiriting: "))
c1 = float(input("c1 ni kiriting: "))
# Get 2- tenglama keoffitsientlarini kiriting (a2x + b2y = c2)
a2 = float(input("\na2 ni kiriting: "))
b2 = float(input("b2 ni kiriting: "))
c2 = float(input("c2 ni kiriting: "))
# Solve the system of equations
tenglamalar_sistemasini_yechish(a1, b1, c1, a2, b2, c2)
|