Skip to content

Instantly share code, notes, and snippets.

@jayant-yadav
Last active April 16, 2017 18:42
Show Gist options
  • Save jayant-yadav/586ae20af9a2f8f2fe1ebadb95ec2a9c to your computer and use it in GitHub Desktop.
Save jayant-yadav/586ae20af9a2f8f2fe1ebadb95ec2a9c to your computer and use it in GitHub Desktop.
FACT2
#include<iostream>
//#include<bits/stdc++.h>
using namespace std;
int main()
{ int i,j,t,n[100];
cin>>t;
while(t--){
cin>>n[i];
if(n[i]==0)
{ cout<<"\n"<<"1";}
else
{ long int fac=1;
for(j=n[i];j>0;j--)
{ fac*=j;
}
cout<<"\n"<<fac;
}
}
return 0;
}
Copy link

ghost commented Apr 16, 2017

WRONG ANSWER

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment