Advertisements
Advertisements
Question
Some of the code given below contains errors. Identify the error and correct it. Write the output of the correct/corrected code.
In the above code h(i),
replace the array by
int MW[] = {56, 21, 33, 78, 95};
Code Writing
Advertisements
Solution
int MW[] = {56, 21, 33, 78, 95};
boolean some = false;
for (int j = 0; j < MW.length; j++)
{
if (MW[j]/100 > 0)
{
System.out.println("Some Value is :" + MW[j]);
some = true;
break;
}
}
System.out.print("SOME =" + some);
shaalaa.com
Is there an error in this question or solution?
Chapter 7: Arrays - One Dimension - Exercises [Page 175]
