Skip to content

Commit

Permalink
Merge pull request #157 from BilgisayarKavramlari/17.-Faktöriyel-Fonk…
Browse files Browse the repository at this point in the history
…siyon

17. faktöriyel fonksiyon Javascript
  • Loading branch information
BilgisayarKavramlari authored Jan 16, 2017
2 parents 7b63d77 + 998c8d2 commit 7ac6fe4
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
20 changes: 20 additions & 0 deletions FaktoriyelDongu.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include<stdio.h>

int main(){

int sayi,faktoriyel=1;

printf("Bir sayi giriniz: ");
scanf("%d",&sayi);

while (sayi>0) {
faktoriyel*=sayi;
sayi--;
}

printf("Faktoriyeli: %d",faktoriyel);



return 0;
}
10 changes: 10 additions & 0 deletions FaktoriyelDongu.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#Python3 için yazılmıştır.
def faktoriyel(sayi):
sonuc=1
while sayi>=1:
sonuc=sonuc*sayi
sayi-=1
return sonuc

deger=int(input("Bir sayi giriniz: "))
print("Faktoriyeli: {}".format(faktoriyel(deger)))
19 changes: 19 additions & 0 deletions FaktoriyelOzyineli.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;

class Program
{
static int faktoriyel(int sayi)
{
return (sayi <= 1) ? 1 : faktoriyel(sayi - 1) * sayi;
}

static void Main(string[] args)
{
int sayi;

Console.WriteLine("Faktöriyeli alınacak sayıyı giriniz:");
sayi = int.Parse(Console.ReadLine());

Console.WriteLine(faktoriyel(sayi));
}
}

0 comments on commit 7ac6fe4

Please sign in to comment.