Why runtime error in this code?

import java.io.;
import java.util.
;

class RECEIPE
{
	
	public static void main(String args[])throws IOException
	{
		Console con = System.console();
		int t = Integer.parseInt(con.readLine());
		for(int i=0;i<t;i++)
		{
			StringTokenizer st = new StringTokenizer(con.readLine());
			int n = Integer.parseInt(st.nextToken());
			int gcd = Integer.parseInt(st.nextToken());
			int arr[] = new int[n];
			arr[0] = gcd;
			int j = 1;
			while(st.hasMoreTokens())
			{
				int a = Integer.parseInt(st.nextToken());
				arr[j] = a;
				j++;
			}
			for(int p=1;p<n;p++)
			{
				gcd = gcd(gcd,arr[p]);
				if(gcd==1)
					break;
			}
			for (int k=0;k<arr.length;k++)
			{
				System.out.print(arr[k]/gcd);
				if(k!=n-1)
					System.out.print(" ");
			}
			System.out.println("");
		}
	}
	public static int gcd(int a,int b)
	{
		if(b==0)
			return a;
		else
			return gcd(b,a%b);
	}
	
}
1 Like
//