Computer Science, asked by arshiad09, 1 month ago

Write a program in java to enter any two numbers and print their H.C.F​

Answers

Answered by venomgirl8
0

Explanation:

Algorithm

Define two variables - A, B.

Set loop from 1 to max of A, B.

Check if both are completely divided by same loop number, if yes, store it.

Display the stored number is HCF.

Answered by johanvp2006
0

Answer:

system.out.println("enter 2 no.s");

a=sc.nextint();

b=sc.next int ();

for (I=1,i≤math.max(a,b),++I)

if(a%i==0&&b%i==0)

system.out.println("HCF "+I);

Similar questions