List the invariant assertions at points A, B, C, D and E in program given…

PYQ GATE 1987

List the invariant assertions at points A, B, C, D and E in program given below:

Program division (input, output)
Const dividend = 81; divisor = 9;
Var remainder, quotient:interger
begin
  (*(dividend >= 0) AND (divisor > 0)*)
  remainder := dividend; quotient := 0; (*A*)
  While (remainder >= 0) do
  begin (*B*)
    quotient := quotient + 1;
    remainder := remainder - divisor; (*C*)
  end;
  (*D*)
  quotient := quotient - 1;
  remainder := remainder + divisor; (*E*)
end

Sign up free to check your answer

Sign up free

Explore the full course: Zero To Hero

Loading lesson…