Questions


August 2023 1 4 Report
Predict the output of the following program snippet:

int a = sc.nextInt();
int b = sc.nextInt();
int p = a*b:
int x = 0;
for (int i = 1; i<p; i++)
{
if(a%i==0 && b%i==0)
x=i;
}
System.out.println("a=" +a+ "b=" +b+ "x=" +x);

Kindly explain briefly (cuz I'm dumb I won't understand if you just write tge output)
⚠️Spam = 5 answers reported​

Answers & Comments


Add an Answer


Please enter comments
Please enter your name.
Please enter the correct email address.
You must agree before submitting.

Helpful Social

Copyright © 2024 EHUB.TIPS team's - All rights reserved.