Talk:Muhammad Rais Habibie

From ccitonlinewiki
Jump to: navigation, search


print ('Persamaan linear dua variabel \n ax + by = c\n px + qy = r ')

a = float(input(" masukan nilai a =")) b = float(input(" masukan nilai b =")) c = float(input(" masukan nilai c =")) p = float(input(" masukan nilai p =")) q = float(input(" masukan nilai q =")) r = float(input(" masukan nilai r ="))


if a == p :

   i = b - q
   j = c - r
   y = j/i
   x = (c -(b*y))/a
   print("nilai y=",y,"nilai x =",x)

elif a != p :

       a2= a*p
       b2=b*p
       c2=c*p
       p2=p*a
       q2=q*a
       r2=r*a
       i2 = b2 - q2
       j2 = c2 - r2
       y = j2 / i2
       x = (c - (b * y))/a
       print("nilai y=", y, "nilai x =", x)

elif a == 0 :

   y = c/b
   x = (r - (q*y))/p
   print("nilai y=", y, "nilai x =", x)

elif b == 0:

   x = c/a
   y = (r - (p * x )) / q
   print("nilai y=", y, "nilai x =", x)

elif p == 0 :

   y = r/q
   x = (c - (a*y) )/b
   print("nilai y=", y, "nilai x =", x)

elif q == 0 :

   x = r/p
   y = (c - (a * x)) / b
   print("nilai y=", y, "nilai x =", x)



input()