the code is taking value of N infinite times . i don’t know why this program is behaving like this ?

```
#include <iostream>
using namespace std;
int main()
{
int T,i,D[100];
cout<<" enter number of test cases you want to perform ";
cin>>T;
for(i=0;i<T;++i)
{
int N[T],A[T],B[T],j,k;
cout<<" enter no of fibonacci series number you want to print ";
cin>>N[i];
cout<<N[i];
A[0]=0;
A[1]=1;
for(j=2;j<N[i];++j)
{
A[j]=A[j-1]+A[j-2];
A[j-2]=A[j-1];
A[j-1]=A[j];
}
for(j=0;j<N[i];++j)
{
B[j]=A[j]%10;
}
while(N[i]!=1)
{
if(N[i]%2==0)
{
for(j=0;j<N[i];j+=2)
{
B[j/2]=B[j];
}
N[i]=N[i]/2;
}
else
{
for(j=0;j<N[i];j+=2)
{
B[j/2]=B[j];
}
N[i]=(N[i]+1)/2;
}
}
D[i]=B[1];
}
for(i=0;i<T;++i)
{
cout<<" the required solution is "<<D[i]<<"\n";
}
return 0;
}```
```