Question: 4 . Bug Hunt Challenge: Common Mistakes in Control Flow and Loops Task Troubleshoot and fix common mistakes related to control flow ( if -
Bug Hunt Challenge: Common Mistakes in Control Flow and Loops
Task
Troubleshoot and fix common mistakes related to control flow ifelse loops, and formatted output.
Instructions
Analyze the provided buggy script buggyscriptm:
Check if a number is positive, negative, or zero
num inputEnter a number: ;
if num
dispThe number is positive.
elseif num
dispThe number is negative.
else
dispThe number is zero.
Calculate the sum of even numbers between and using a while loop
and incrementing i by for each loop iteration.
sumeven ;
i ;
while i
sumeven sumeven i;
end
fprintfThe sum of even numbers between and is: d
sumeven;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
