2024-07-01 15:45:07 +00:00
|
|
|
class Example1b {
|
2024-06-28 09:28:58 +00:00
|
|
|
public int fak(int number){
|
|
|
|
if(number < 0){
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
int factorial = 1;
|
|
|
|
int i = 0;
|
|
|
|
while(i < number){
|
|
|
|
factorial = factorial * i;
|
|
|
|
}
|
|
|
|
return factorial;
|
2024-06-20 09:03:27 +00:00
|
|
|
}
|
|
|
|
}
|