Consider this program segment int count; for (count = 2; count < value; count ++) { if (nums[count] < anyNumber) System.out.print (“ALWAYS”); } What is the maximum number of times that ALWAYS can be printed; |
Consider this program segment int count; for (count = 2; count < value; count ++) { if (nums[count] < anyNumber) System.out.print (“ALWAYS”); } What is the maximum number of times that ALWAYS can be printed; |
Answer:
(value - 2) is the maximum number of times that ALWAYS can be printed;
EXPLANATION:
if value=6 then 4 is the maximum number of times that ALWAYS can be printed
if (nums[count] < anyNumber) is true for every time then gets (value - 2) is the maximum times
here value, nums[] and anyNumber are not declared here if not consider.
Get Answers For Free
Most questions answered within 1 hours.