mirror of
https://hub.njuu.cf/TheAlgorithms/C-Plus-Plus.git
synced 2023-10-11 13:05:55 +08:00
I added algorithm to find factorial of a number
This commit is contained in:
parent
c0f018bd79
commit
61664e9639
18
Math/factorial.cpp
Normal file
18
Math/factorial.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
cout<<"Enter number = ";
|
||||
cin>>n;
|
||||
int num=1;
|
||||
for(int i=1;i<n;i++)
|
||||
{
|
||||
num*=i;
|
||||
}
|
||||
cout<<"Factorial of number is = ";
|
||||
cout<<num<<endl;
|
||||
|
||||
return 0;
|
||||
}
|
BIN
Math/factorial.exe
Normal file
BIN
Math/factorial.exe
Normal file
Binary file not shown.
BIN
Math/factorial.o
Normal file
BIN
Math/factorial.o
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user