Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem: Write a C++ program with a function that takes two integer arguments an

ID: 3657220 • Letter: P

Question

Problem:
Write a C++ program with a function that takes two integer arguments and returns their product. Use this function in the main function to produce a multiplication table for 1 through 9.
NOTE: The program takes NO user input. If you use nested loops, this program can be done in less than 10
statements. However, you do not have to use nested loops. The key point for this practice is to use a function that accepts two integers and returns their product.


The output should look something like:

1 x 1 =1
1 x 2 = 2
1 x 3 = 3

etc all the way up to 9 x 9 = 81


The following is what I have so far, but I keep doing something wrong:

#include <iostream>
using namespace std;


int printMultiples()
{
int j = 1,
i = 1,
result;

for ( ; j < 10; j++)
{
cout << j ;
}

for( ; i < 10; i++)
{
result = (j * i);
cout << " x " << i << " = " << result << " ";
}

return (j,i,result);
}
//-------------------------------------------------

int main ()
{
cout << "This is a multiplication table for 1 through 9 ";
cout << "------------------------------ ";


cout << printMultiples() ;


return 0;
}

Explanation / Answer

See I have modified the program to run ur way.Please check it #include using namespace std; void printMultiples() { int i,j,result; for ( j=1; j < 10; j++) { for(i=1 ; i < 10; i++) { result = (j * i); cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote