Answer to Question #327751 in C++ for hole smole

Question #327751

write a program to find the table of numbers using a while loop. your program should ask about the size of the table. the size defines the rows and columns. sample output


Enter size : 6


1 2 3 4 5 6

----------------------------------

1* 1 2 3 4 5 6

2* 2 4 6 8 10 12

3* 3 6 9 12 15 18

4* 4 8 12 16 20 24

5* 5 10 15 20 25 30

6* 6 12 18 24 30 36


1
Expert's answer
2022-04-12T13:26:33-0400
#include<iostream>

using namespace std;

int main()
{
	int szTb;
	cout << "Please, enter the size of the table: ";
	cin >> szTb;
	for (int i = 1;i <= szTb; i++)
	{
		cout << i << " ";
	}
	cout << endl;
	for (int i = 0; i <= szTb; i++)
	{
		cout << "---" ;
	}
	cout<<endl;
	for (int i = 1; i <= szTb; i++)
	{
		cout << i << "* ";
		for (int j = 1; j <= szTb; j++)
		{
			cout << j*i << " ";
		}
		cout << endl;
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS