Doubt in fibonacci pattern 4, I cannot understand why run error is coming in one test case

import java.util.;
public class Main {
public static void main(String args[]) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int t=(n
(n+1))/2;
int[] arr=new int[t];
arr[0]=0;
arr[1]=1;
for(int i=2;i<t;i++)
{
arr[i]=arr[i-1]+arr[i-2];
}
int nst=1,i=0;
for(int row=1;row<=n;row++)
{
for(int cst=1;cst<=nst;cst++)
{
System.out.print(arr[i]+"\t");
i=i+1;
}
System.out.println();
nst=nst+1;
}
}
}

check ur code for input 1

i would suggest u to don’t store the fib no in the array
this should be done using varibles

just like the star pattern

hope this will help u
pls rate my work so that i can improve myself

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.