retagged by
1,365 views

2 Answers

4 votes
4 votes

Cyclomatic complexity will be equal to four(4).

formula

1. Cyclomatic complexity = No of predicates +1

for the Given program, predicates are if, while. total 2 if and 1 while condition.

so answer will be 4.
 

2 votes
2 votes

I am not sure but somewhere back in my memory I do remember...that I read it

-> In program fragments .... cyclomatic complexity= (no. of conditional statements +1)

So for this program .....2 "if condition" =2

and 1 "while condition" which have AND conjuction means again comparisons = 1

Therefore 3+1 = 4 is the cyclomatic complexity

But I am not sure whether Else condition will taken in account or not , if it'll be taken in then CC will be 5

@Arjun sir ...kindly check this and correct me 

edited by

Related questions

0 votes
0 votes
1 answer
2
Ramayya asked Jan 7
277 views
McCabe’s cyclomatic complexity number of a program control graph ‘$G$’ with $e$edges, $n$ nodes and $p$ disconnected paths is defined as$n – e + 2p$$e – n + 2 +...
0 votes
0 votes
2 answers
3
admin asked Jul 21, 2022
519 views
A particular control flow graph has $15$ nodes out of which $7$ are decision nodes. The cyclomatic complexity and number of edges respectively can be given by the followi...