- Back to Home »
- Factorial vectores
Posted by : Unknown
jueves, 12 de junio de 2014
El factorial de un entero positivo n, el factorial de n o n factorial se define en principio como el producto de todos los números enteros positivos desde 1 (es decir, los números naturales) hasta n. Por ejemplo,
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
namespace
ConsoleApplication44
{
class Program
{
static void Main(string[]
args)
{
int[]
a = new int[10];
int[]
b = new int[10];
int
fac;
int
i, j;
{
for
(i = 0; i < 10; i++)
Console.Write(" a ["+i+"]=");
a[i] = int.Parse(Console.ReadLine());
for
(i = 0; i < 10; i++) ;
fac = 1;
for
(j = 1; j <= a[i]; j++)
{
fac = fac* j;
}
b[i] = fac;
for
(i = 0; i < 10; i++) ;
Console.WriteLine("ingrese el factorial");
Console.ReadLine();
}
}
}
}