# Function factorial (iterative) - Practice Exercises C# Sharp

## Lesson 5:

## Functions

## Exercise 5.23:

## Function factorial (iterative)

## Objetive:

##
Create an iterative (non-recursive) function to calculate the factorial of the number
specified as parameter:

Console.Write ( Factorial (6) );

would display

720

## Source Code:

```
using System;
public class Exercise112
{
public static float Factorial(int n)
{
int result = 1;
for (int i = 1; i <= n; i++)
{
result *= i;
}
return result;
}
public static void Main()
{
Console.Write(Factorial(6));
}
}
```

Exercisey
5.23