(iii) With reference to the code given below answer the questions that follow.

void Solve(int n)
{ int a=1,b=1;
for (int i=n;i>0;i=i/10)
{ int d=i%10;
if (d%2==0)
a=a*d;
else
b=b*d;
}
System.out.println(a+" "+b);
}
(a) What will the function Solve( ) return when the value of n=3269?
(b) What is the method Solve( ) computing?


Solution



(i) 12 27
(ii) It is calculating the product of even and odd digits separately


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