I'm trying to modify the code below so each first number in column is based on the row number.
int i, sum = 0;
for (int row = 0; row < 7; row++)
{
for (i = 1; i < 6; i++)
{
sum = sum + i;
Console.Write("{0} ", i);
}
Console.WriteLine(sum);
sum = 0;
}
Console.Read();
presents this in console:
1 2 3 4 5 15
1 2 3 4 5 15
1 2 3 4 5 15
1 2 3 4 5 15
1 2 3 4 5 15
1 2 3 4 5 15
1 2 3 4 5 15
But I'm trying get like this:
1 2 3 4 5 sum
2 3 4 5 6 sum
3 4 5 6 7 sum
4 5 6 7 8 sum
and so on..
......
....
Any idea on how to solve this?
i = 1. Maybe that's something you can change?