Question
Since it is a structured program, the rules you can follow are ... * A program with no conditions has a CFG with three nodes
Since it is a structured program, the rules you can follow are ...
* A program with no conditions has a CFG with three nodes (including the start and end nodes) and two edges and V(G) = 2-3+2(1)=1.
Using: V(G)= E-N+2p
* The addition of each if-then-else statement increases the number of nodes (N) by 3 and edges (E) by 4.
* The addition of each if-then or while statement increases the number of nodes (N) by 2 and edges (E) by 3
* Thus, the net increase in cyclomatic complexity is 1 for each decision in the program.
With that in mind, what is the cyclomatic complexity V(G) of the following program?
b) For the following structured program P2, calculate the cyclomatic complexity using the structured program decision count rule. Show your work. Program P2 1)integer A, B; 2) input (A) 4) if (A > 7) 5) 7) 8) else 9) 10) B=2; if(A7 14) 15) while (1-1 ; 1Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started