Can recursive programs be written in C++, Write a recursive program to calculate factorial in C++?

Submitted by: Administrator
#include #include int fact (int ); void main() { int n, a; cout<<"enter any value"; cin>>n; a=fact(n); cout<< a; getch(); } int fact (int x) { if((x==0) || (x==1)) return 1; else return(x*(x-1)); }
Submitted by: Administrator

Read Online Hardware and Software Design Job Interview Questions And Answers