vendredi 24 juin 2016

c++ tgamma() function has different outputs

if you enter n=6, this code returns 719

int main()
    {
        long n,k;
        cin>>n;
        k = tgamma(n+1);
        cout<<k;
    }

while this code below will return correct answer 720

int main()
{
    long n,k;
    n=6;
    k = tgamma(n+1);
    cout<<k;
}

why is this happening?

Aucun commentaire:

Enregistrer un commentaire