like this please tell me that right
or send a cod to me
#include<iostream>
#include<math.h>
using namespace std;
double fact(int num1){
double sum=0;
for(int i=1;i<=num1;i++)
sum=log10(i)+sum;
return sum;
}
int main(){
int num,num2[100];
cin>>num;
for (int i=0;i<num;i++)
cin>>num2[i];
for (int j=0;j<num;j++)
cout<<pow(10,fact(num2[j]))<<endl;
}
or like this
#include<iostream>
#include<math.h>
using namespace std;
void fact1(int k){
if (k<=33)
{
double long fact=1;
fact=1;
for(int b=k;b>=1;b--)
{
fact=fact*b;
}
cout<<fact<<endl;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////code for numbers which are greater than 33 ///////////////////////////////////////////////////////////
else
{
int numArr[10000];
int total,rem=0,count; //rem use to save remainder of division(Carry Number).
register int i; //register will enhance performance by minimizing access time
//int i;
for(i=0;i<10000;i++)
numArr[i]=0; //set all array on NULL.
numArr[10000]=1; //start from end of array.
for(count=2;count<=k;count++)
{
while(i>0)
{
total=numArr[i]*count+rem; //rem will add the carry number to the next array digit that is multiplied to the count
rem=0;
if(total>9)
{
numArr[i]=total%10;
rem=total/10;
}
else
{
numArr[i]=total; //numArr[i] is being accessed in this for loop because we have made i as register which means the memory is allocated
}
i--;
}
rem=0;
total=0;
i=10000;
}
for(i=0;i<10000;i++)
{
if(numArr[i]!=0 || count==1)
{
cout<<numArr[i];
count=1;
}
}
cout<<endl;
}
}
int main(){
int num,num2[100];
cin>>num;
for (int i=0;i<num;i++)
cin>>num2[i];
for (int j=0;j<num;j++)
fact1(num2[j]);
}