Recursive Fonksiyonlar
Tarih : 10 Haz 2009 3:00 am / Kategori : C Sharp Net
Double FaktoryelHesapla(int Deger)
{
Double CarpimSonuc = 1;
if (Deger > 1)
{
CarpimSonuc = Deger * FaktoryelHesapla(Deger - 1);
}
return CarpimSonuc;
}
private void button1_Click(object sender, EventArgs e)
{
int SayiBul;
Double SonucDeger;
SayiBul = 5;
SonucDeger = FaktoryelHesapla(SayiBul);
this.Text = “Faktoryel Sonuc = ” + SonucDeger.ToString();
}
Yorum yaz
Yorum yazmak icin kayitli kullanici olmalisiniz.