Problem in question FCTRL2

Hi Guys,

I recently encountered a problem in the beginner question FCTRL2.
This is my code:

#include <stdio.h>

int main()
  int t,i,j,n,fact=1,l;
  int a[t-1];

  return 0;

This produced the desired output when I ran it in Dev C++. However, when I submit my question, they keep telling it is a wrong answer.
I would like to know whether my approach to the problem is wrong or not.

Thank you.

Try to think the range of output.(till 100! too large to use int or even long).
try this test case you will understand

Well it should give wrong answer indeed. You are using int data type which has a range of approximately 10^9 but the constraints of the problem are upto 100 .
So obviously this integer won’t fit in int data type and for that matter it won’t even fit in long long int or unsigned long long int .
So you need to change your approach and once you are done with coding check the value of 100! once to get an idea whether your code is correct or not.

Hi guys!

Thanks for your feedback. I understood my problem. If it were Java or Python I could use the Big Integer class. I am not sure whether they work on C/C++. I guess the safest way were to treat my numbers as strings and carry on with my code, if I am correct.

yes in c/c++ you can go with arrays to solve this question.

By strings i mean using arrays. The word strings isn’t appropriate here.