0
1.1kviews
Consider the program given below, (i) Draw the flow graph. (ii) Determine the cyclomatic complexity. (iii) Arrive at all the independent paths.

void main

{

int i, j, k;

readln(i, j, k);

{

writeln("then when);

if(j<k)</p>

writeln ("j less then $\mathrm{k} ")$;

else writeln ( "not less then k ");

}

else writeln( "else Part");

}

1 Answer
0
146views

Solution:

(i) Draw the flow graph and source code:

void main()

{

int i,j,k;

readln (i,j,k);

if( (i < j) || ( i > k) )

{

writeln("then part");

if (j < k)

writeln ("j less then k");

else writeln ( " j not less then k");

}

else writeln( "else Part");

}

enter image description here

(ii) Determine the cyclomatic complexity:

= E - N + 2

= 12 - 10 + 2

= 4

(iii) Arrive at all the independent paths:

Path1: 1 2 3 9 10

Path2: 1 2 4 5 7 8 10

Path3: 1 2 4 5 6 8 10

Path4: 1 2 3 4 5 7 8 10

Please log in to add an answer.