# include <iostream >
usingnamespace std;
int main()
{
int row;
int col;
int col2;
for (row=1 ; row <7 ; row++)
{
cout << row <<endl;
for(col= 0;col <= row; col++)
{
for(col2=1; col2 < row; col2++)
{
}
cout << col2 << " ";
}
}
system ("pause");
return 0;
}
I have changed this around so that it can increment the rows but not the columns but then I can't get the first line to change. This is driving me crazy. Not in school BTW just trying to teach myself how to code.
#include <iostream>
int main()
{
constint NUM_ROWS = 6 ;
for( int row = 1 ; row <= NUM_ROWS ; ++row ) // for each row 1 .. NUM_ROWS
{
// print numbers row, row+1 ... (row times)
for( int col = 0 ; col < row ; ++col )
{
std::cout << row+col << ' ' ;
}
std::cout << '\n' ; // and a new line at the end of each row
}
}
int main ( )
{
int count; // the number of numbers to print
constint rows = 6; // the number of rows to print
int num; // the number to print
for ( count = 1; count <= rows; ++count )
{
num = count;
for ( int i = 0; i < count; ++i )
{
std::cout << num++ << ' ';
}
std::cout << '\n';
}
}