Ağustos 15th, 2007
Recursive Metotlar ile Faktöriyel Hesabı:
////////////////////Cihan TURGUT////////////////
using System;
class paramsornek
{
static int faktoriyel(int a)
{
if (a == 0)
return 1;
return a * faktoriyel(a – 1);
}
static void Main()
{
Console.WriteLine(faktoriyel(0));
Console.WriteLine(faktoriyel(1));
Console.WriteLine(faktoriyel(4));
Console.ReadLine();
}
}
Filed under: CSharp
Leave a Reply
You must be logged in to post a comment.