Pemecahan Persamaan Linear

Assalamualaikum, . .
Selamat siang semuanya, Kali ini saya akan membagikan tentang pemecahan persamaan linear, . .

Langsung saja dicoba ya, . .

import java.util.Scanner;

public class SolveLinearEquation {

public static void main(String[] iriahus) {
@SuppressWarnings("resource")
Scanner s = new Scanner(System.in);

System.out.println("Solve the equation ax + by = e and cx + dy = f");
System.out.println("----------------------------------------------");

System.out.print("Enter a, b, c, d, e, and f: ");
double a = s.nextDouble();
double b = s.nextDouble();
double c = s.nextDouble();
double d = s.nextDouble();
double e = s.nextDouble();
double f = s.nextDouble();

// Finds the value of x and y using Cramer's rule
double x = (e * d - b * f) / (a * d - c * b);
double y = (a * f - e * c) / (a * d - c * b);

System.out.println("x is " + x + " and y is " + y);
}

}

Thanks for visiting, .  Semoga bermanfaaat, . .

Subscribe to receive free email updates:

0 Response to "Pemecahan Persamaan Linear"

Post a Comment