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;
}
I have used CodeBlocks compiler for debugging purpose. But you can use any C++ programming language compiler as per your availability.
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