6 Mayıs 2015 Çarşamba

C# Konsolda Girilen 10 Sayının Faktöriyelleri Toplamı




using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {



        static void Main(string[] args)
        {
            double faktoriyel = 0, toplam = 0;
            double[] sayi = new double[10];
            for (int i = 0; i < 10; i++)
            {
                Console.Write("Sayıyı giriniz: ");
                sayi[i] = double.Parse(Console.ReadLine());
            }
            for (int i = 0; i < 10; i++)
            {
         

                faktoriyel = 1;

                for (int f = 1; f <= sayi[i]; f++)
                {
                    faktoriyel = faktoriyel * f;
                }
                Console.WriteLine(faktoriyel);
                toplam = toplam + faktoriyel;
            }
            Console.WriteLine("Toplam= {0} ",toplam);
            Console.ReadKey();
        }
    }
}