hw6 - I is: n = q*d + r and r " 0 and d > 0 { n...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
COP4020 Spring 2011 Homework Assignment 6 1. Using axiomatic semantics, prove the correctness of the following algorithm that computes the quotient q and remainder r of n / d (that is, it computes q and r such that n = q * d + r and 0 ! r < d ). The loop invariant
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: I is: n = q*d + r and r " 0 and d > 0 { n " 0 and d > 0 } => (implies) { } q := 0 { } r := n { } while r " d do { } => (implies) { } r := r – d { } q := q + 1 { } end do { } => (implies) { n = q * d + r and 0 ! r < d }...
View Full Document

This note was uploaded on 02/01/2012 for the course COP 4020 taught by Professor Engelen during the Spring '11 term at FSU.

Ask a homework question - tutors are online