Wrote the factorial program in C++