-
Notifications
You must be signed in to change notification settings - Fork 896
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #157 from BilgisayarKavramlari/17.-Faktöriyel-Fonk…
…siyon 17. faktöriyel fonksiyon Javascript
- Loading branch information
Showing
3 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | ||
} | ||
} |