First, let it identify each statement. Im using the letters here, but it can be numbers instead.
A while(m<n)
B,C if(x>y) AND (a<b) then
D a=a+1
E y=y-1
end if
F m=m+1
G end while
- Note that the second operator has two conditions / predicates / decision points (or whatever you call them), so I call them B and C.
- I am going to use
end while(G) as an exit point.
Now we can draw a control flow graph (CFG):

, Cyclomatic Complexity (M) :
: