Help anyone , problem code: FCTRL2

on submitting showing as wrong though my code giving right output plz do explain why anyone.
#include
using namespace std;

int fact(int n)
{
return (n == 1 || n == 0) ? 1 : n * fact(n - 1);
}
int main() {
int t,a[10],i;
cin>>t;
for(i=0;i<t;i++)
{
cin>>a[i];
}
for(i=0;i<t;i++)
{
cout<<fact(a[i]);
cout<<"\n";
}
return 0;
}

There can be between 1 to 100 inputs, You are considering that there are only 10. Also i guess you can’ t store all the inputs. You have to process the queries online.