Hi i am finding this a challenge.I am suppose to get
12345
12345

but my below code is giving me
1112314151
1222324252

what mistake am i making?

#include <iostream>
using namespace std;

int main()
{
 int row,column;
for(row=1;row < 3;row++)
{
   for(column=1 ;column < 6; column++)
      cout <<column<< row <<' ';
      cout <<endl;
}

return (0);
}

ok another question just for knowledge.What if i want to chane the below code to

12345
12345

to

AAAAA
AAAAA

how to go about

OK, here is why your program is doing what it's doing:

In line 7, row is set to 1, then the for loop at line 9 loops 5 times, and when it does, row does not change, does it?
After the for loop at line 9 loops 5 times then the for loop at line 7 increments row to the value of 2, and then the for loop at line 9 executes again 5 times in which row remains the same during the 5 loops with only column changing.

In line 10, you are printing out column and then row right after that, and then repeating that 5 times. So row always comes after column, so then row must always be 1 larger than column, right?? What would cause that? All you need to do is print out 12345 and then go down a line and do it again. That can't be that hard, is it? I think that you are over thinking this deal. : )

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.