Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6127697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:32:29+00:00 2026-05-23T16:32:29+00:00

The Cyclomatic Complexity of the pseudocode below is 4. Read A Read B IF

  • 0

The Cyclomatic Complexity of the pseudocode below is “4”.

Read A
Read B
IF A > 0 THEN
     IF B  = 0 THEN
    Print “No values”
     ELSE
    Print B
    IF A > 21 THEN
        Print A
    ENDIF
     ENDIF
ENDIF

How do we count it?
I heard that it’s # of conditions + 1? Do we count those else statements? I’m confused.

EDIT:
Case 2:
What if we have:

IF (x < y)
statment 1

IF (x < z)
statemnt 2

What will be the Cyclomatic complexity? 2? or 3?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:32:29+00:00Added an answer on May 23, 2026 at 4:32 pm

    No. Main flow + 3 x ‘If‘s = 4

    From the wiki:

    The cyclomatic complexity of a section of source code is the count of
    the number of linearly independent paths through the source code. For
    instance, if the source code contained no decision points such as IF
    statements or FOR loops, the complexity would be 1, since there is
    only a single path through the code.

    If the code had a single IF
    statement containing a single condition there would be two paths
    through the code, one path where the IF statement is evaluated as TRUE
    and one path where the IF statement is evaluated as FALSE.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A term that I see every now and then is Cyclomatic Complexity. Here on
I'm looking for extensions that can show code metrics (especially cyclomatic complexity) beside method
Recently our company has started measuring the cyclomatic complexity (CC) of the functions in
After reading What’s your/a good limit for cyclomatic complexity? , I realize many of
I want to know which tool can be used to measure the cyclomatic complexity
The complexity of methods in most programming languages can be measured in cyclomatic complexity
At work we are using several tools to capture several metrics (mostly cyclomatic complexity
I've been playing around with measuring the cyclomatic complexity of a big code base.
I am searching for a Cyclomatic Complexity Api in Delphi (2010). I need to
Is there a better way to compact this method i.e. reduce the cyclomatic complexity

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.