FACTORIAL OF NUMBER

factorial

#1

What m doing wrong in this 10 lines?

`#include<iostream[link text][1]>using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t,n,res=1,i;
	cin >> t;
	while(t!=0){
		cin>>n;
		if(n>=0){
			for(i=1;i<=n;i++) {
				res=res*i;
			}
			cout<<res<<endl;
			res=1;
		}
			
		t--;
	}
	return 0;

}`

#2

How big can n be?

For a C++ int data type, the maximum positive value it can hold is 2147483647 on most modern compilers.

If n >= 13, n! is larger than C++ max int. So you may need to rethink the data structure you use.

Good luck!