Console'de Faktoriyel Hesaplama

1
Onaylı Üye
Üye
Katılım
4 Mayıs 2010
Mesajlar
615
Tepki puanı
7
Konum
İstanbul/Pendik
Kod:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Faktoriyel
{
    class Program
    {
     static void Main(string[] args)
            {
         Console.Write("Bir sayı gir : ");
         int sayi = Convert.ToInt32(Console.ReadLine());

         int sonuc = Faktoriyel(sayi);

         Console.WriteLine(sayi + "Faktoriyel : " + sonuc.ToString());
         Console.ReadLine();

            }
     static int Faktoriyel(int sayi);
        {
             if (sayi == 0) return 1;
             return sayi * Faktoriyel(sayi - 1);
        }
    
    }
}

Kaynak:Gokturks.org
 
0
Onaylı Üye
Üye
Katılım
22 Mart 2010
Mesajlar
4,806
Tepki puanı
85
Konum
Angara'nın Bağları
birşeyi merak ediyorum ben bunda öz yinelemeli fonksiyon mu hızlı çalışır yoksa döngü mü?
 
Geri
Üst