Choose the pseudocode for the below problem statement.
Answer options
Correct answer: BEGIN, DECLARE variables number, reverse, rem, temp, READ number, SET reverse = 0, temp = number, WHILE number !=0 DO, rem = number%10, reverse = reverse*10 + rem, number = number/10, END WHILE, IF temp == reverse THEN, PRINT "Number is Fancy", ELSE, PRINT "Number is Not Fancy", END IF, END
Explanation
Block D (indices 54-68) is the correct palindrome-check pseudocode. It correctly initialises reverse=0 and temp=number BEFORE the loop, then extracts digits with rem=number%10, builds reverse, and divides number by 10. After the loop it correctly prints 'Number is Fancy' when temp==reverse and 'Number is Not Fancy' otherwise. Block A inverts the print messages; Block B divides before extracting rem (wrong algorithm); Block C initialises inside the loop (resets each iteration) and has a missing PRINT in the THEN branch.