Fonksiyon ile Faktöriyel Bulma — Csharp
[code lang=”csharp”]
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Faktoriyel_bulan_fonksiyon
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnHesapla_Click(object sender, EventArgs e)
{
lblSonuc.Text = "Sonuç : " + txtSayi.Text + " ! = " + faktoriyel(int.Parse(txtSayi.Text));
}
int faktoriyel(int sayi)
{
int toplam = 1;
for (int i = 1; i <=sayi; i++)//www.gorselprogramlama.com
{
toplam *= i;
}
return toplam;
}
}
}
[/code]

