Skip to content

Commit

Permalink
Merge pull request AdarshAddee#121 from navdeepk037/patch-1
Browse files Browse the repository at this point in the history
created factorial program in cpp
  • Loading branch information
AdarshAddee committed Oct 4, 2022
2 parents cb9790b + 0bf8613 commit 79ea1ce
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions C++/factorialprogram.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include<iostream>
using namespace std;
// github username navdeepk037 https://github.com/navdeepk037
int fact(int n)
{
int factorial=1;
for(int i=n;i>=1;i--)
factorial=factorial*i;
return factorial;
}
int main(){
int n;
cout<<"enter the number ";
cin>>n;
cout<<"the factorial of the number is "<<fact(n);

}

0 comments on commit 79ea1ce

Please sign in to comment.