#include

using namespace std;

int main() {

int i,fac=1,a[100],n;

cin>>n;

for(i=0;i<n;i++) {

cin>>a*;

}

for(i=0;i<n;i++) {

fac=1;

while(a*>1) {

fac=fac*a*;

a*–;

}

cout<<"

"<<fac;

}

return 0;

}

#include

using namespace std;

int main() {

int i,fac=1,a[100],n;

cin>>n;

for(i=0;i<n;i++) {

cin>>a*;

}

for(i=0;i<n;i++) {

fac=1;

while(a*>1) {

fac=fac*a*;

a*–;

}

cout<<"

"<<fac;

}

return 0;

}

Please see the :

Constraints

1 ≤ T ≤ 100

1 ≤ N ≤ 100

you have taken int fact. int value is not enough to hold 100!

Your Answer is Coming Wrong Because You Can not store value of factorials in int because you can imagine the number of digits in 100! its very large and int can store in range -2,147,483,647 to 2,147,483,647.

Hi, you can use long long int for factorials of some no but for some no like 100 (whose factorial has 158 digits) would not be possible from your code to calculate it because c++ does not have any data type to contain such large numbers you can have a look at this link if you are not able to figure out anything - http://www.geeksforgeeks.org/factorial-large-number/

happy coding, hope I was of some help