Question: Draw a control flow graph for the following sample code. Determine the cyclomatic complexity of the graph. (a) sum_of_all_positive_numbers(a, num_of_entries, sum) (b) sum = 0
Draw a control flow graph for the following sample code. Determine the cyclomatic complexity of the graph.
(a) sum_of_all_positive_numbers(a, num_of_entries, sum)
(b) sum = 0
(c) init = 1
(d) while(init <= num_of_entries)
(e) if a[init] > 0
(f) sum = sum + a[init]
endif
(g) init = init + 1
endwhile
(h) end sum_of_all_positive_numbers
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
