Please post formal proof rules used in proof if function is
Please post formal proof rules used in proof if function is correct.
Following are four functions intended to return the a12] a[n] for n 1 (the sum of the first n in an array value a[1] produce correct results, goes wrong. entries of integers). For those that do not explain what For those that do produce correct results, do proof of correctness.Solution
This is correct.
Proof:
first i = 0 ; j= 0;
loop starts:
first element is added to j
index incremented
loop continues
second element is added to j
index incremented
and so-on the loop continues untill the last element
after the last element n is added to j ; the loop ends
and then j is returned which contains the sum of all first n elements
![Please post formal proof rules used in proof if function is correct. Following are four functions intended to return the a12] a[n] for n 1 (the sum of the first Please post formal proof rules used in proof if function is correct. Following are four functions intended to return the a12] a[n] for n 1 (the sum of the first](/WebImages/37/please-post-formal-proof-rules-used-in-proof-if-function-is-1113184-1761590714-0.webp)