C# Fonksiyon ile Faktoriyel Bulma

Konu sahibi son olarak 3315 gün önce görüldü
Kod:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
  
namespace ConsoleApplication22
{
    class Program
    {
        static int faktoriyel(int a)
        {
            int sonuc = 1;
            for (int i = 1; i <= a; i++)
            {
                sonuc=i * sonuc;
            }
            return sonuc;
        }
 
        static void Main(string[] args)
        {
            Console.WriteLine("Faktöriyeli Hesaplanacak Sayıyı Giriniz = ");
            int a = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("İşlemin Sonucu =" + faktoriyel(a));
            Console.ReadLine();
        }
    }
}
 
Geri