Saturday, 18 March 2017

Geeksforgeeks Solution For " Small Factorial "

GeeksforGeeks Solution For School Domain .Below You Can Find The Solution Of Basic ,Easy ,Medium ,Hard .You Can Also Direct Submit Your Solution to Geeksforgeeks Same Problem .You Need to login then you can submit you answers 

Problem :- Calculate factorial of a given number N.

Submit Your Solution :- Click Here 


Solution :- 

#include <iostream>
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
       unsigned long long int i,n,fact=1;
       cin>>n;
       for(i=1;i<=n;i++)
       fact=fact*i;
       cout<<fact<<endl;
    }
    return 0;
}

Output:-


Geeksforgeeks Solution For " Small Factorial "

No comments:
Write comments

Recommended Posts × +