/*format agency fb bold 14*/ /*program to find the factorial of a number using recursions*/ #include<stdio.h> #include void main() { int n,f; int fact(int); clrscr(0; printf("enter the number to find the factorial:"); scanf("%d",&n); f=fact(n); printf("\nthe factorial of the given number is %d",f); getch(); } int fact(int n) { int f; f=n*fact(n-1); return f; } //program to find factorial using classes #include #include class factorial { private: int facto,i; public: void setvalue() { facto=1; } int fact(int); }; int factorial::fact(int n) { for(i=1;i<=n;i++) { facto=facto*i; } return facto; } void main() { int n; fcatorial f; f.setvalue(); cout<<"enter the number to find factorial:"; cin>>n; cout<<"the factorial of the given number is "<
getch(); } thank you vinaychalluru