I wrote a code to get factorial for a number uptil 100. The problem i have is that i have to display the array it is sstored in a single output. So i cant use for statement and print each element.
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
int array[200];
int count;//keepas count of the number of digits.
int temp;//store the carry over.
int t; // no of cases
int num; //stores the fact.
int i,j,k;
int x;
cin>>t;
while(t--)
{
cin>>num;
array[0]=1;
count= 1;
temp=0;
for(i=2;i<=num;i++)
{
for(j=0;j<count;j++)
{
x=(array[j]*i)+temp;
array[j]=x%10;
temp=x/10;
}
while(temp!=0)
{
array[j]=temp%10;
temp/=10;
j++;
count++;
}
}
for(i=count-1;i>=0;i--)
{
cout<<array[i];
}
}
}