Kamis, 19 Agustus 2010

Alpro Week - 3

import java.util.Scanner;

public class hitungLinier {

public static void main(String[] args){

Scanner s = new Scanner (System.in);

System.out.println("a1x+b1y=c1");
System.out.println("a2x+b2y=c2");

System.out.println("Enter a1 =");
int a1=s.nextInt();

System.out.println("Enter b1 =");
int b1=s.nextInt();

System.out.println("Enter c1 =");
int c1=s.nextInt();

System.out.println("Enter a2 =");
int a2=s.nextInt();

System.out.println("Enter b2 =");
int b2=s.nextInt();

System.out.println("Enter c2 =");
int c2=s.nextInt();

double x;
double y;
x= (double) (((c1*b2)+(c2*b1))/((a1*b2)-(a2*b1)));
y= (double) (((a1*c2)-(a2*c1))/((a1*b2)-(a2*b1)));

System.out.println("Jadi nilai x =" +x);
System.out.println("Jadi nilai y =" +y);


}

}

Tidak ada komentar:

Posting Komentar