(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.


Contact Us

REACH US

SERVICES

  • CODING
  • ON-LINE PREPARATION
  • JAVA & PYTHON

ADDRESS

B-54, Krishna Bhawan, Parag Narain Road, Near Butler Palace Colony Lucknow
Contact:+ 919839520987
Email:info@alexsir.com