Computer Science, asked by ritwik46, 1 year ago

write a program in Java to accept four numbers and find the LCM HCF of the four numbers

Answers

Answered by Anonymous
8
hope this will help u
/* Java Program Example - Find HCF LCM of Two Numbers */
import java.util.Scanner; public class
JavaProgram { public static void main(String args[])
{ int a, b, x, y, t, hcf, lcm; Scanner scan = new Scanner(System.in);
System.out.print("Enter Two Number : "); x = scan.nextInt();
y = scan.nextInt();
a = x; b = y; while(b != 0)
{ t = b; b = a%b; a = t; }
hcf = a; lcm = (x*y)/hcf;
System.out.print("HCF = " +hcf); System.out.print("\nLCM = " +lcm); } }
plz mark brainiest
#neymarjr3
Answered by shubhu51
3

Answer:

this is wrong answer because it has been. asked four and you have done four

Similar questions