MCPcopy Create free account
hub / github.com/chaharnishant11/CodeIn10DSA / main

Function main

C++/Code/factorialUsingLoop.cpp:5–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3using namespace std;
4
5int main(){
6 int n;
7 cin>>n;
8 int ans = 1;
9 for(int i=1;i<=n;i++){
10 ans = ans * i;
11 }
12 cout<<"factorial of "<<n<<" is "<<ans<<endl;
13
14 cin>>n;
15 ans = 1;
16 for(int i=1;i<=n;i++){
17 ans = ans * i;
18 }
19 cout<<"factorial of "<<n<<" is "<<ans<<endl;
20
21 cin>>n;
22 ans = 1;
23 for(int i=1;i<=n;i++){
24 ans = ans * i;
25 }
26 cout<<"factorial of "<<n<<" is "<<ans<<endl;
27}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected