write a programme in c++ of factorial by using function
Answers
Answered by
1
Answer:
Explanation:
#include <iostream>
#include <conio.h>
void main()
{
cout << "Enter the number to find factorial" << endl;
void factorial();
factorial();
getch();
return 0;
}
void factorial()
{
int fact=1,n,i;
cin>>n;//get input from user
for(i=1; i<=n; i++){
fact=fact*i;//find factorial using for loop
}
cout<<"Factorial of "<<n<<" is: "<<fact;
}
Similar questions