Skip to content

Commit 0998f13

Browse files
authored
Create Faktoriyel.java
1 parent 0df2613 commit 0998f13

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Faktoriyel.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.company;
2+
3+
import java.util.Scanner;
4+
5+
public class Faktoriyel {
6+
public static void main(String args[]){
7+
Scanner scanner = new Scanner(System.in);
8+
System.out.print("Sayı Giriniz: ");
9+
int sayi = scanner.nextInt();
10+
int faktoriyel = faktoriyel(sayi);
11+
System.out.println(sayi+"! = "+faktoriyel);
12+
}
13+
14+
public static int faktoriyel(int sayi){
15+
int carpim =1;
16+
for(int i = 1; i < sayi+1; i++){
17+
carpim = carpim*i;
18+
}
19+
return carpim;
20+
}
21+
}

0 commit comments

Comments
 (0)