The outputs for the test cases work perfectly fine, but if the numbers get big the output gets out wrong cry

#include<iostream>
using namespace std;
int fact(int n)
{
    if (n!=1)
        return n* fact(n-1);
}
int main()
{
    int t,n;
    cin >> t;
    while(t--)
    {
            cin >> n;
            cout << fact(n) << endl;
    }
    return 0;
}
  • created

    Nov '14
  • last reply

    Dec '14
  • 1

    reply

  • 239

    views

  • 2

    users

24 days later

They sure do. There is no raw number datatype that will hold a number as large as 100!. If I were to give you a piece of paper and a pencil, how would you calculate 100! ?