TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Calculate Linear equation using Java
Senthilvelan Sambamoorthy
Aug 13
2016
Code
765
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
ssvli.rar
// 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);
}
}
}
Java