Find the Cyclomatic Complexity of the following code segment: int average (int[ ] value, int min, int max, int N) { int i, totalValid, sum, mean; i = totalValid = sum = 0; while ( i < N || value[i] != -999 ) { if (value[i] >= min && value[i] <= max){ totalValid += 1; sum += value[i]; if (totalValid > 0) mean = sum / totalValid; else mean = -999; } i += 1; return mean; N.B. N=2466, min = 6, max = 15124 %3!

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter15: Recursion
Section: Chapter Questions
Problem 6PE
icon
Related questions
Question
Find the Cyclomatic Complexity of the following code segment:
int average (int[ ] value, int min, int max, int N) {
int i, totalValid, sum, mean;
i = totalValid = sum = 0;
if (value[i] >= min && value[i] <= max){
totalValid += 1; sum += value[i];
if (totalValid > 0)
mean = sum / totalValid;
else
mean = -999;
}
i += 1;
}
return mean;
N.B.
N=2466, min = 6, max = 15124
Transcribed Image Text:Find the Cyclomatic Complexity of the following code segment: int average (int[ ] value, int min, int max, int N) { int i, totalValid, sum, mean; i = totalValid = sum = 0; if (value[i] >= min && value[i] <= max){ totalValid += 1; sum += value[i]; if (totalValid > 0) mean = sum / totalValid; else mean = -999; } i += 1; } return mean; N.B. N=2466, min = 6, max = 15124
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Computational Systems
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
New Perspectives on HTML5, CSS3, and JavaScript
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:
9781305503922
Author:
Patrick M. Carey
Publisher:
Cengage Learning