Advertisements
Advertisements
Question
Observe the following code. It may contain Syntax, Logical or runtime errors. Execute it in Java and identify the error, if any. Rewrite the code without the error. Also write the aim of the code.
double fnTask(double p, double q)
{
double d = p/q:
double r = p%q;
return d, r;
}Code Writing
Advertisements
Solution
double[] fnTask(double p, double q)
{
double d = p/q;
double r = p%q;
return new double[]{d, r};
}
shaalaa.com
Is there an error in this question or solution?
