Problem code: FCTRL2 i have made the solution in java but yet it is giving wrong answer on submitting and when i m running its giving ryt answer please help me out . i have pasted the code below.
import java.io.*;
class solution{
public static void main(String args[]) throws
IOException
{
BufferedReader br = new BufferedReader(new
InputStreamReader(System.in));
int[] a=new int[200];
int i=0,m=0,temp=0;
int T=Integer.parseInt(br.readLine());
if(T>100)
{
System.exit(0);
}
while(T>0){
int n=Integer.parseInt(br.readLine());
if(n>100)
{
System.exit(0);
}
int n1=n;
if(n<100){
a[i]=n;
m++;
i++;
}
else{
while(n>0)
{
a[i]=n%10;
m++;
i++;
n=n/10;
}
}
for(int j=n1-1;j>0;j–)
{
i=0;
while(i<m)
{
int x=a[i]*j+temp;
temp=x/10;
a[i]=x%10;
i++;
}
while(temp>0)
{
m++;
a[i]=temp%10;
temp=temp/10;
i++;
}
}
while(m>0)
{
System.out.print(a[–m]);
}
System.out.println();
T=T-1;
}
}
}