#include

using namespace std;

int main()

{

int t,n,fact;

cin>>t;

while(t–)

{

fact=1;

cin>>n;

while(n!=0)

{

fact=fact*n;

n–;

}

cout<<fact<<endl;

}

}

otherwise you can do this with the help of recursive fuction . I f you in need then I’ll give you the sollution.

You can’t do this question this way since n<=100 and 100! Has 157 digits , which is way greater than capacity of long and long long , you will have to make an array of digits and fill it one by one by multiplying and adding the carry like you studied multiplication in class 2 or 3

Eg. to calculate 14*15 you will have to multiply 4 by 15 give 6 as carry and multiply 1 by 15 and then add 6 resulting in 210