HOW TO MAKE CALCULATION WITHIN A CLASS? W#

-5

I'm doing the following program in C #:

Create an abstract class named "Combinatorial Analysis", which is responsible for specifying, in addition to calculating the factorial of a number, the methods due for Calculation of Permutations, Arrays and Combinations of elements.

I need to make a class called Combinatorial Analysis where I have to calculate the factorial of a number to be entered by the user in the main program.

I know how to do the factorial, but inside a class, you are not even free to do any kind of equal accounts in static void Main.

This is the method I've done:

public abstract class AnaliseCombinatoria
    {
        static int Fatorial(int numero)
        {
            for(int i = 0; numero <= 1; i--)
            {
                return numero * (numero - 1);
            }
        }

    }

You are giving an error in the variable "Factorial" saying: "AnalyzeCombinatoria.Fatorial (int)": Not all code paths return a value

How do you do calculations inside a class?

    
asked by anonymous 18.10.2018 / 15:11

1 answer

1

Error in question refers to the return within the Loop;

Put like this:

static int Fatorial(int numero)
    {
        for(int i = 0; numero <= 1; i--)
        {
            numero = numero * (numero - 1);
        }
        return numero;
    }
    
22.11.2018 / 19:47