14 lines
262 B
Java
14 lines
262 B
Java
class Example1b {
|
|
public int fak(int number){
|
|
if(number < 0){
|
|
return 1;
|
|
}
|
|
int factorial = 1;
|
|
int i = 0;
|
|
while(i < number){
|
|
factorial = factorial * i;
|
|
}
|
|
return factorial;
|
|
}
|
|
}
|