0
22kviews
Draw the control flow graph and find the cyclomatic complexity for a program largest of three numbers.

Mumbai University > Information Technology > Sem 8 > Software Testing and Quality Assurance

Marks: 10 Marks

Difficulty : Medium

1
2.1kviews

Independent paths:

An independent path is any path through the graph that introduces at least one new set of processing statement or new condition. An independent path must move along at least one edge that has not been traversed before the path is defined.

cyclomatic complexity:

cyclomatic complexity can be designed through the given formula

v(6) = e - n + 2p

where

e is the no. of edges

n is the no. of nodes in the graph

p is the no. of components in the whole graph.

void main c { int a, b, c, max,

1. print f ('enter 3 integers"),

2. scan f (" %d %d %d", & a, & , & c),b

3. if (a >) b

4. if ( a > c)

5. Max = a

6. else max = c,

7. else if (b > c)

8. Max = b

9. else max = c

10. print and ( "a max = % d", max), 3 No. of independent paths

v (a) = e - n + 2

= 11 - 9 + 2

= 4

No. of procedures = 1

$\therefore$ cyclomatic complexity

= e - n + 2 P

= 11 - 9 + 2

= 4