def dfact(n: Int): BigInt = { var prod: BigInt =1 if (n > 0) { if (n % 2 == 0) for(i<-2 to n if i % 2 == 0) prod *= i else for(i<-1 to n if i % 2 != 0) prod *= i } return prod } println(dfact(21)) println(dfact(22))