Question: (b) Refer to the code below to answer questions (b.1) and (b.2): $i = 4; while($i
(b) Refer to the code below to answer questions (b.1) and (b.2): $i = 4; while($i <= 7){ if($i%2 != 0) echo "$i - Odd number "; else echo "$i - Even number "; $i++; } (b.1) What is the output generated by the given code? (4 marks) (b.2) Rewrite the code to use for loop instead of while without changing its logic. (4 marks)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
