Answer to Question #191170 in C++ for python

Question #191170

Write function in C++ that will calculate table of a number in C++. Number must be passed from calling function as an argument to function parameters.


1
Expert's answer
2021-05-13T03:15:44-0400
//C++ function to calculate table of number using function with parameters
#include<iostream>


using namespace std;
//table function declaration
void table(int x);
int main()
{
    int num;
    cout<<"Enter a number to calclate the table of the number and press Enter key: ";
    cin>>num;
    //Function call
    table(num);
    
    return 0;


}
//table function definition
void table(int x)
{
    for(int a=1;a<=10;a++)
    {
        cout<<x<<" x "<<a<<" = "<<x*a<<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