Computer Science, asked by jisha07, 10 months ago

write a C++program to find the
factorial of a given number​

Answers

Answered by as8ab0
0

Answer:

logic : fact=n*(n-1) *(n-2)....

Explanation:

put in a loop with a counter to check

Answered by sougatap57
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