Find the output of the snippet:
int a[]={1,2,3,4,5,6};
for (i=0;i<5;i++)
{
a[i]=a[a+1]+a[i];
a[i+1]=a[i]-a[i+1];
a[i]=a[i]-a[i+1];
}
for(i=0;i<6;i++)
{
System.out.print(a[i]);
}
Answers
Answered by
1
Error because variable “i” isn’t initialised.
Int i =0;
After declaring array or before.
Int i =0;
After declaring array or before.
Similar questions