C# Programming - Arrays - Discussion
Discussion Forum : Arrays - General Questions (Q.No. 15)
15.
What will be the output of the C#.NET code snippet given below?
namespace IndiabixConsoleApplication
{
class SampleProgram
{
static void Main(string[ ] args)
{
int i, j;
int[ , ] arr = new int[ 2, 2 ];
for(i = 0; i < 2; ++i)
{
for(j = 0; j < 2; ++j)
{
arr[i, j] = i * 17 + i * 17;
Console.Write(arr[ i, j ] + " ");
}
}
}
}
}Discussion:
3 comments Page 1 of 1.
Ultron said:
1 decade ago
Isn't I pre-increment?
Vamsi said:
1 decade ago
First iteration of i.
0*17+0*17=0.
0*17+0*17=0.
Second iteration of i.
1*17+1*17=34.
1*17+1*17=34.
Answer is 0 0 34 34.
0*17+0*17=0.
0*17+0*17=0.
Second iteration of i.
1*17+1*17=34.
1*17+1*17=34.
Answer is 0 0 34 34.
Tarun Suneja said:
1 decade ago
Can any one tell me about the function of this program, not able to understand?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers