Q:

Calculate Linear Equation using Java

0

This Program is used to calculate the Linear Equation concept.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

// linear equation program 

import java.io.*; 
class ssvli 
{ 
public static void main(String arg[]) 
{ 
float x1,x2,a,b,c,d,m,n,z; 
a=2;b=3;c=4;d=5;m=6;n=8; 
System.out.println("1st linear equation is=> "+a + "x1 +" + b +"x2=" +m); 
System.out.println("2ed linear equation is=> "+c + "x1 +" + d +"x2=" +n); 
System.out.println("using formula and we get the val of x1 & x2 as:"); 
z=(a*d)-(c*b); 
if(z==0) 
{ 
System.out.println("************the denominator (a*d)-(c*b) is not equal to zero"); 
} 
else 
{ 
x1=(m*d-b*n)/(a*d-c*b); 
x2=(n*a-m*c)/(a*d-c*b); 
System.out.println(" x1="+x1); 
System.out.println(" x2="+x2); 
} 
} 

}

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now