Q:

Write C++ program to print multiplication table of a given number

0

Write C++ program to print multiplication table of a given number

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

I have used CodeBlocks compiler for debugging purpose. But you can use any C++ programming language compiler as per your availability.

#include <iostream>
using namespace std;
 
int main()
{
    int num=0, i;
   //Reading number
 
    cout<<"Enter number to print table: "<<endl;
    cin>>num;
    for(i=1; i<=10; i++)
    {
        //Printing table of number entered by user
        cout<<num<<" x "<<i << " = "<<num*i<<endl;
    }
    return 0;
 
}

Result:

Enter number to print table: 

5

5 x 1 = 5

5 x 2 = 10

5 x 3 = 15

5 x 4 = 20

5 x 5 = 25

5 x 6 = 30

5 x 7 = 35

5 x 8 = 40

5 x 9 = 45

5 x 10 = 50

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Write C++ program to print all natural numbers in ... >>
<< Write C++ program to print ASCII value of all Uppe...