Does the repair satisfy the specification?

A procedure accepts any non-negative integer nn and sets x=nx=n. Before each repetition, it checks whether xx is different from zero. If so, it subtracts 2 from xx and checks again; otherwise, it stops and outputs xx. The specification requires it to stop and output zero for every permitted input. Which statements are true? Select all that apply.

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More What Is an Algorithm? Questions: