Answer to Question #274246 in C++ for Hassan

Question #274246

Write the code to display a table consisting of four rows and six columns. The first column should contain the numbers 1 through 4 raised to the first power. The second column should contain the result of raising the number in the first column to the second power. The third column should contain the result of raising the number in the first column to the third power, and so on. Use two for statements: one to keep track of the numbers 1 through 4, and the other to keep track of the powers (1 through 6).


1
Expert's answer
2021-12-01T15:35:17-0500
#include<iostream>
#include<cmath>
using namespace std;

int main()
{
	for (int i = 1; i < 5; i++)
	{
		for (int n = 1; n < 7; n++)
		{
			cout << pow(i, n) << '\t';
		}
		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