(iii)
With reference to the code given below, answer the questions that follow along
with dry run / working.
boolean num(int x)
{
int a=1;
for (int c=x; c>0; c/=10)
a * = 10;
return (x * x % a) == x;
}
(a) What will the function num() return when the value of x=25?
(b) What is the method num() performing?
Solution
(b) The function is checking whether the number is automorphic or not.