C plus plus doubt

using namespace std;
int main() {int fact=1,n,t;
for(int j=1;j<=t;j++)
for(int i=1;i<=n;i++)
return 0;}

I have written this code and getting the correct output but when i submit it it says wrong answer.Please help me.its the 4th problem in beginners (most successful)

Because n can have value up till 100 and 100! is 150+ digits long, you can’t use int or longlong to store this. Use arrays.

Here’s the solution https://www.geeksforgeeks.org/factorial-large-number/

PS: always add problem link and format your code.

1 Like