1. Write a program factorial.cpp that uses recursion to multiply numbers 1 throu
ID: 3622612 • Letter: 1
Question
1. Write a program factorial.cpp that uses recursion to multiply numbers 1 through n. Print out the answer.
Sample execution:
Enter a number? 4 The factorial of 4 is 24
#include<iostream>
using namespace std;
int fact(int n){
int f = 1;
for ( int i=0; i <= n;i++)
f=i*f;
return f;
}
int main() {
cout<<"Enter a number?";
cin<<mul;
cout<<"The factorial of"<<n" is " <<m<<endl;
}
Thats the codewrote for this problem but i keep getting a error I'm wondering what I did wrong and how can I fix it.... =]