Factorial Question - Need help

Help to find the answer to this question.
Problem Link - https://www.codechef.com/problems/FCTRL2

hey @Ojhajogeshkumar, it is very simple question, you just need to find factorial for each test case. Please try to do it yourself. If you face any issue, feel free to ask

Sir. I have tried plz help me out.

hey @Ojhajogeshkumar, here is the code for the same https://ide.codingblocks.com/s/64206

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

Kindly check your code by submitting in the codechef platform

Hey @Ojhajogeshkumar
The above code will work fine for small integers, however, for large integers, the factorial is going to be a very large number. It is not possible to store these many digits even if we use long long int. So for such a case, we use an array to store individual digits of the result. In the given question of codechef, the range of N goes till 100,now 100 factorial will be very large, and hence can’t be stored in integer or long long int, so you’ll have to use array as mentioned above, do try to solve using this approach, you can always ask for help if you get stuck.

Hey @mahimahans111
As you said I have tried it already
But in implementing I’m bit confused.
plz help.
This code is for saving multiplication of two no. in array.

#include<bits/stdc++.h>
using namespace std;
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int a, b;
  cin>>a>>b;
  int c=b, count=0;
  while(b!=0)
  {
    b/=10;  
    count++;
  }
  int temp=0, arr[count];
  for(int i=0;i<count;i++)
  {
    arr[i]=c%10;
    c/=10;
    arr[i]=a*arr[i]+temp;
    temp=arr[i]/10;
    if(i<count-1)
        arr[i]=arr[i]%10;
  }
  for(int i=count-1;i>=0;i--)
    cout<<arr[i];
  return 0; 
}