Write a program in C++ to find factorial of entered number

#include <iostream.h>
#include <conio.h>

int main() {

 int num,factorial=1;
 
 cout << "Enter Number: ";
 cin >> num;
 
 for (int a=1;a<=num;a++) {
  factorial=factorial*a;
 }
 
 cout<<"Factorial: "<< factorial << endl;
 return 0;
}


Output:

Leave a Reply

Contact Form

Name

Email *

Message *

Followers