Dynamic Arrays - Java
dynamic arrays or jagged arrays are used to create variant columns for each row.
WRITE A PROGRAM TO PRINT THE NUMBERS IN THE FOLLOWING FORMAT USING 2D ARRAY.
class Array5
{
public static void main(String args[])
{
int a[][]=new int[3][5];
int i,j,k=0;
for(i=0;i<3;i++)
{
for(j=0;j<5;j++)
{
a[i][j]=k;
k++;
}
}
for(i=0;i<3;i++)
{
for(j=0;j<5;j++)
{
System.out.print(a[i][j]);
}
System.out.println();
}
}
}
For
More Explanation
&
Online Classes
More Explanation
&
Online Classes
Contact Us:
+919885348743
+919885348743