Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Factorial
#include <iostream.h>
#include <math.h>
int main()
{
int d = 0;
int q = 1;
cout<<"enter number"<<endl;
cin>>d;
for(int a = 1; a <= d; a++) {
q = q * a;
}
cout<<"the factorial is "<<q;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment