Skip to content

Instantly share code, notes, and snippets.

@0xDaksh
Created August 13, 2017 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0xDaksh/28a66d13ad17a098e27ad6d4cb2f01a8 to your computer and use it in GitHub Desktop.
Save 0xDaksh/28a66d13ad17a098e27ad6d4cb2f01a8 to your computer and use it in GitHub Desktop.
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