|
C++ Row Column Array Nested Loop pow(x,y)
|
Visit Homework Solution for any kind of Homework Help .
1.) Write a nested loop that displays a table consisting of 3 rows and 11
columns. The first column should contain the number 1-3. The second and
subsequent columns should contain the result of raising the number in the first
column by the numbers 0-9. The table will look similar to the following chart.
Sue two "for" statements and the "pow()" function. The function's syntax is "Pow(x,y),
where "x" is the number you want raised to power "y". At least one of the
function's arguments must be a "double" number. For a program to use the
function, it will need to contain the "#include " instruction.
1 1 1 1 1 1 1 1 1 1 1
2 1 2 4 8 16 32 64 128 256 512
3 1 3 9 27 81 243 729 2187 6561 19683
#include
#include
int main() {
int i, j;
for(i=1; i <= 3 ; i++)
{
for(j=0; j < 10; j++)
{
cout << pow(i, j) << " ";
}
cout << endl;
}
return 0;
}
|
|