The output of the following code is different from the ouput from the second code can someone explain the problem?
Code 1:
for(int i = 1; i <= intInput; i++)
{
for(int j = 1; j<=i; j++)
{
Console.Write('+');
Console.WriteLine();
}
}
if intInput is 4 Ouput is:
+
+
+
+
Code 2:
for(int i = 1; i <= intInput; i++)
{
for(int j = 1; j<=i; j++)
Console.Write('+');
Console.WriteLine();
}
if intInput is 4 Ouput is:
+
++
+++
++++
I know how this line of codes works but i dont understand what difference the brackets make on both codes?