write a C++program to find the
factorial of a given number
Answers
Answered by
0
Answer:
logic : fact=n*(n-1) *(n-2)....
Explanation:
put in a loop with a counter to check
Answered by
0
Answer:
#include <iostream>
using namespace std;
int main()
{
int a1,fact=1;
cout<<"enter the range for the factorial";
cin>>a1;
for(int a2=1;a2<=a1;a2++)
{
fact=fact*a2;
}
cout<<"factorial is"<<fact;
return 0;
}
Output
enter the range of the factorial 5
factorial is 120
Similar questions
Social Sciences,
6 months ago
English,
6 months ago
Social Sciences,
6 months ago
Physics,
11 months ago
Sociology,
1 year ago