$\underline{\textbf{Answer:}\Rightarrow}\;\mathbf {c.}(4)$
$\underline{\textbf{Explanation:}\Rightarrow}$
Cyclomatic complexity is defined as the quantitative estimate of the number of linearly independent paths in it.
It is calculated using the control flow graph of the program.
$\underline{\text{Example:}}$
If a code does not have any control flow statement then the cyclomatic complexity will be $\mathbf 1$.
If the source code contains $\textbf {one if condition}$ then the cyclomatic complexity will be $\mathbf 2$ since there will be $\textbf{two paths}$ one for true and another one for false.
For while loop cyclomatic complexity will be $\mathbf 1$
In this question, Number of while loops are $2$. So, cyclomatic complexity of the while loop $=2\times 1$
Number of if statement $=1$. So, cyclomatic complexity of the if statement $=2$
$\therefore$ Total cyclomatic complexity $=2+2 = 4$
It can also be calculated by drawing the control flow diagram and using the below formula:
$\mathbf{M = E-N+2P}$
where,
$\mathbf E = $Number of edges in the control flow graph.
$\mathbf N =$ the number of nodes in the control flow graph.
$\mathbf P = $the number of connected components.
$\therefore \;\mathbf c$ is the correct option.
https://www.geeksforgeeks.org/cyclomatic-complexity/