Open In App

GATE | GATE-IT-2004 | Question 69

Like Article
Like
Save
Share
Report

Consider the following program module:

int module1 (int x, int y) {
    while (x! = y) {
        if (x > y)
             x = x - y,
        else y = y - x;
        }
    return x;
}

What is Cyclomatic complexity of the above module?
(A) 1
(B) 2
(C) 3
(D) 4


Answer: (C)

Explanation: Condition nodes :

1.While

2. if

Cyclomatic Complexity=2+1=3

 

Quiz of this Question


Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads