Header Ads Widget

C++ program to print table of user’s choice

  

 C++ program to print table of user’s choice

Given a number , write a program to print the table of the number .

Sample input

 3

Sample output

 3 6 9 12 15 18 21 24 27 30

C++ program to print table of user’s choice

The objective of the code is to print the table of a number given by user .

Code(C++):-

#include <iostream>
using namespace std;
int main()
{
int i,n;
cout<<"Enter a number : ";
cin>>n;
for(i=1;i<=10;i++)
cout<<(n*i)<<" ";
return 0;
}

Output:-

Enter a number : 3
3 6 9 12 15 18 21 24 27 30


Recommended Post :-

HCL Coding Questions:-

Capgemini Coding Questions:-

Companies interview:-

Full C course:-    

Key points:-

Cracking the coding interview:-

 Array and string:-

Tree and graph:-

Hackerearth Problems:-

Hackerrank Problems:-

Data structure:-

 MCQs:-