factorial spoj solution in c