Write a nested loop that displays a table consisting of 3 rows and 11 columns. The first column should contain the numbers 1 through 3. The second and subsequent columns should contain the result of multiplying the number in the first column by the numbers 0 through 9. The table will look similiar to the following chart. Use two "for" statement.
1 0 1 2 3 4 5 6 7 8 9
2 0 2 4 6 8 10 12 14 16 18
3 0 3 6 9 12 15 18 21 24 27
Thanks all
Help me with this C++ coding problem please?
#include%26lt;iostream%26gt;
using namespace std;
int main()
{
for( int i=1; i %26lt;= 3; i++ ) {
cout %26lt;%26lt; endl %26lt;%26lt; i;
for( int j=0; j %26lt;= 9; j++ ) {
cout %26lt;%26lt; " " %26lt;%26lt; (j*i);
}
}
return 0;
}
Reply:ill give you a hint.....
u need a counter and 2 variables(3 INTs)....
Reply:#include%26lt;iostream.h%26gt;
#include%26lt;conio.h%26gt;
#include%26lt;math.h%26gt;
void main()
{
clrscr();
for(int i=1;i%26lt;=3;i++)
{
for(int j=10;j%26lt;21;j++)
{
cout%26lt;%26lt;abs(j-11)*i;
}
cout%26lt;%26lt;'\n';
}
getch();
}
Reply:gosh, you didn't even try
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment