small factorial: displays correct answer but with leading zeros!! plz help

smallfactorial

#1

why my code shows leading zeros in the answer of the factorial, however it produces the right result.

#include <iostream.h>
int m;
int i;
void mul(int *ans, int num);
int main()
{ int n,num;
	int ans[200];
	cin>>n;
	while(n--)
	{ m=1;
	ans[0]=1;
	for(i=1;i<200;i++)
	 ans*=0;
	 cin>>num;
	  if(num)
	  {
		while(num>0)
		{ mul(&ans[0],num);  //ans= ans * num;
		  num--;
		  }
		 }
	  for(i=m; i>0; i--)
	  cout<<ans*;
	  }
	  return 0;
	  }
 void mul(int *ans, int num)
{
 int temp=0;
 int index;
  for(i=0;i<m;i++)
	{   index=i;
	  int x= num*ans[index]+temp;
	  ans[index]= x%10;
	  temp= x/10;
	  }
	while(temp>0)
	{ ans[index++]= temp%10;
	 temp=temp/10;
	 m++;
	 }
	}