plz help me out…it shows garbage value

#include

using namespace std;

int main()

{

```
int i,j,k,fact,a[200];
int m=0,n,temp,x,z,p;
cin>>i;
while(i>0 && i<=100)
{
cin>>n;
j=n;
if(n>0 && n<=100)
{
```

`` while(j!=0)

{

```
x=j%10;
a[m]=x;
j=j/10;
m++;
}
for(i=n-1;i>0;i--)
{
for(p=0;p<m;p++)
{
z=(i*a[p])+temp;
a[p]=z%10;
temp=z/10;
}
while(temp!=0)
{
a[m]=temp%10;
temp=temp/10;
m++;
}
}
for(p=0;p<m;p++)
cout<<a[p];
cout<<"\n";
}
i--;
}
return 0;
```

}