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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!