factorial using ternary operator