Code for GCD computation by Euclid's method
while (x != y) { if (x > y) x = x - y; else y = y - x; } return x;
Determining McCabe's Cyclomatic Complexity
Method #1
N = No. of nodes = 7
E = No. of edges = 8
V(G) = E - N + 2 = 8 - 7 + 2 = 3
Method #2
V(G) = Total no. of non overlapping areas + 1 = 2 + 1 = 3
Method #3
V(G) = Total no. of decision statements and loops + 1 = 1 + 1 + 1 = 3