Mira S.

asked • 06/08/22

I need help with the following question

Hi, I need help with the following question


Prove the program is correct using Hoare logic inference rules where a and b are any two arbitrary numbers.and it is using repeated addition

{b>=0}

w := b;

z := 0;

WHILE (w!=0) {

z := z+a;

w := w-1;

}

{z=a*b}

start by identifying the loop invariant then apply the rules


note: I have used another website to get the answer but they only said it is correct, without any steps or explanation

Mira S.

the answer from the other website https://www.coursehero.com/tutors-problems/Computer-Science/41653659-using-repeated-addition-where-a-and-b-are-any-two-arbitrary/
Report

06/08/22

1 Expert Answer

By:

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.