Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
The second installment of the experiment is about cyclomatic complexity.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CodeReadability
{
public class CyclomaticComplexity
{
public int First(int number)
{
if (number % 12 == 0)
return 12;
return number;
}
public int Second(int number)
{
if(number > 15 || number < -234)
{
return 0;
}
else if(number > 10)
{
if (number == 8)
return 22;
return 4;
}
return 9;
}
public int Third(int number)
{
if (number == 8)
return 93;
if(number > 0)
{
if(number % 2 == 0)
{
return 2;
}
else if(number % 3 == 0)
{
return 26;
}
else if(number % 5 == 0)
{
return 5;
}
else
{
if (number == 49)
return 18;
return 10;
}
}
else
{
if(number > -15)
{
if (number > -100)
return number;
else if (number > -50)
return -24;
}
return 33;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment