how to use array to perform or to write or to create structure of matrix.
declaration of array using for loop ,initialization of array using for loop.
how to create 2/2 or 3/3 array in simple programming language
creation of 2/2 array which will appear like matrix.
int[,] arr = new int[2,2]
{
{1, 2,3 } ,
{4, 5 ,6},
};
for (int i = 0; i <2; i++)
{
for (int j = 0; j<2; j++)
{
Response.Write((arr[i,j]));
}
Response.Write("<br>");
}
creation of 3/3 array
int[,] arr = new int[3,3]
{
{1, 2,3 } ,
{4, 5 ,6},
{889, 9 ,93},
};
for (int i = 0; i <3; i++)
{
for (int j = 0; j<3; j++)
{
Response.Write((arr[i,j]));
}
Response.Write("<br>");
}
printing of 2/3 array using for loop.
int[,] arr = new int[2,3]
{
{1, 2,3 } ,
{4, 5 ,6},
};
for (int i = 0; i <2; i++)
{
for (int j = 0; j<3; j++)
{
Response.Write((arr[i,j]));
}
Response.Write("<br>");
}
response.write use in asp.net to print array so if you want to print in c language just use printf.
whereas in java it is system.out.println
0 comments: