(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