Nagarro interview question

Write a program for factorial.