2018-05-29 22:27:20 +00:00
|
|
|
import java.lang.Integer;
|
2019-06-06 10:15:51 +00:00
|
|
|
//import java.lang.Long;
|
|
|
|
//import java.lang.Short;
|
2018-05-29 22:27:20 +00:00
|
|
|
|
2018-09-19 13:52:29 +00:00
|
|
|
public class Faculty {
|
2019-10-22 14:44:38 +00:00
|
|
|
public fact;
|
|
|
|
Faculty() {
|
|
|
|
fact = (x) -> {
|
2019-04-21 20:31:55 +00:00
|
|
|
if (x == 1) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return x * (fact.apply(x-1));
|
|
|
|
}
|
|
|
|
};
|
2019-10-22 14:44:38 +00:00
|
|
|
}
|
2019-08-23 13:06:54 +00:00
|
|
|
|
2019-04-21 20:31:55 +00:00
|
|
|
|
|
|
|
|
2023-05-24 11:53:23 +00:00
|
|
|
public getFact(java.lang.Integer x) {
|
2019-04-21 20:31:55 +00:00
|
|
|
return fact.apply(x);
|
|
|
|
}
|
|
|
|
}
|
2018-11-08 12:02:33 +00:00
|
|
|
// m (x) {
|
|
|
|
//
|
|
|
|
//// var fact = (x) -> {
|
|
|
|
//// if (x == 1) {
|
|
|
|
//// return x;
|
|
|
|
//// }
|
|
|
|
//// else {
|
|
|
|
//// return x * (fact.apply(x-1));
|
|
|
|
//// }
|
|
|
|
//// };
|
|
|
|
//// return fact;
|
|
|
|
//// var x = 13;
|
|
|
|
//// if(x>22) {
|
|
|
|
//// return 0;
|
|
|
|
//// }else if(x <1){
|
|
|
|
//// return x;
|
|
|
|
//// }else {
|
|
|
|
//// return 1;
|
|
|
|
//// }
|
|
|
|
//
|
|
|
|
// if (x < 0) {
|
|
|
|
// return 0;
|
|
|
|
// }else if(x<2) {
|
|
|
|
// return x;
|
|
|
|
// } else {
|
|
|
|
// return x * m(x-1);
|
|
|
|
// }
|
|
|
|
// }
|
2019-06-28 09:41:19 +00:00
|
|
|
//}
|