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
Linear search using Java
Senthilvelan Sambamoorthy
Aug 13
2016
Code
518
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
ssvlin.rar
// linear search program
import
java.io.*;
class
ssvlin
{
public
static
void
main(String args[])
throws
IOException
{
System.out.println(
"From equations ax1 + bx1= m ; cx1+dx1 = n"
);
DataInputStream dis =
new
DataInputStream(System.in);
System.out.print(
"Enter your 'a' number :"
);
int
a = Integer.parseInt(dis.readLine());
System.out.print(
"Enter your 'b' number :"
);
int
b = Integer.parseInt(dis.readLine());
System.out.print(
"Enter your 'c' number :"
);
int
c = Integer.parseInt(dis.readLine());
System.out.print(
"Enter your 'd' number :"
);
int
d = Integer.parseInt(dis.readLine());
System.out.print(
"Enter your 'm' number :"
);
int
m = Integer.parseInt(dis.readLine());
System.out.print(
"Enter your 'n' number :"
);
int
n = Integer.parseInt(dis.readLine());
int
dina = (a * d) - (c * b);
int
numr1 = (m * d) - (b * n);
int
numr2 = (n * a) - (m * c);
System.out.println(
"your number :"
+ dina);
System.out.println(
"your number :"
+ numr1);
System.out.println(
"your number :"
+ numr2);
if
(dina==
0
)
{
System.out.println(
"The value (ad-cb)becomes Zero"
);
}
else
{
double
x1 = numr1 / dina;
System.out.println(
"Result x1 :"
+ x1);
double
x2 = numr2 / dina;
System.out.println(
"Result x2 :"
+ x2);
}
}
}
Java