Popular Post

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,

5! = 1  \times  2  \times  3  \times  4  \times  5 = 120.  \


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();
            }
        }
    }
}

Leave a Reply

Subscribe to Posts | Subscribe to Comments

- Copyright © Programación #5 - Date A Live - Powered by Blogger - Designed by Johanes Djogan -