Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Bounty
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Linear search using Java
WhatsApp
Senthilvelan Sambamoorthy
Aug 13
2016
564
0
0
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
Up Next
Linear search using Java