4.Write a program that accepts two numbers from the user and return the LCM of two numbers
1
Expert's answer
2012-09-04T10:35:53-0400
import java.util.Scanner;
public class Test {
public static void main(String[] args) { double a = 0; double b = 0; Scanner s = new Scanner(System.in); System.out.println("Input numbers: "); a = s.nextDouble(); b = s.nextDouble(); double x = a; double y = b; while (a != b) { if (a > b) a = a - b; else b = b - a; } System.out.println("LCM= " + x * y / a);
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment