Multiplication Table | Practice | GeeksforGeeks

Print the multiplication table of a given number N. 

Example 1:
Input:
N = 9

Output:
9 18 27 36 45 54 63 72 81 90

Explanation:
The table of 9 is the output whose 1st 
term is 9 and the 10th term is 90.

Example 2:
Input:
N = 2

Output:
2 4 6 8 10 12 14 16 18 20



Your Task:  
You don't need to read input. Your task is to complete the function getTable() which takes an integer N as input parameter and returns a list of integers denoting the multiplication of table of N from 1 to 10. 

Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)

Constraints: 
1 <= N <= 106
0
rsbly7300951 week ago
  getTable(N) {
      let table = [];
      
    for(let i = 1; i <= 10; i++) {
        table.push(N*i);
    }
    return table;
  }
}
0
p66ldbtsyygxakejw499ya21le3xno52xzcotukc2 weeks ago
[...Array(10)].map((_, i) => i < 10 ? String((i + 1)*N) : '' )
0
avijit1126be203 weeks ago
class Solution{   static ArrayList<Integer> getTable(int N){       // code here       ArrayList<Integer> val = new ArrayList<Integer>();              for(int i=1;i<=10;i++)       {           val.add(i*N);       }       return val;   }}
0
fmurga3 weeks ago
class Solution { getTable(N) {   //code here   let res = [];   for (let i=1;i<=10;i++){       res.push(i*N)   }   return res }}
0
jayprakashdhananjay4 weeks ago
class Solution:
    def getTable(self,N):
        return map(lambda x:x*N,range(1,11))
0
satyabratasbr1 month ago
def printpat(n) :
        for i in range(1, 11) :
                  print(i*n) 
printpat(9) 
 
0
jabirmohammad210720021 month ago
All Test cases Passes ! code.
vector<int> getTable(int N)   {       vector<int>v;        for(int i=1;i<=10;i++)       {           v.push_back(i*N);        }       return v;    }
0
amrendra0871 month ago
class Solution{   static ArrayList<Integer> getTable(int N){        // Write Your Code here      ArrayList<Integer> numberTable = new ArrayList<>();       for(int i=1;i<=10;i++){           //System.out.print(N*i+" ");           int tableCalculation = i*N;           numberTable.add(tableCalculation);       }              return numberTable;   }}
0
syedabdulwasay71 month ago
Python solution
 
class Solution:    def getTable(self,N):        c=0        for i in range(1, 11):            c = i * N            print(c,end=" ")
0
mohammadtanveer75401 month ago
class Solution
{
public:
    vector<int> getTable(int N)
    {
        vector<int> v(0);
        for(int i=1;i<=10;i++)
            cout<<N*i<<" ";
        return v;
    }
};

We strongly recommend solving this problem on your own before viewing its editorial. Do you still
                    want to view the editorial?
 Login to access your submissions. 

Problem


Contest

Reset the IDE using the second button on the top right corner.
Avoid using static/global variables in your code as your code is tested against multiple test cases and these tend to retain their previous values.
Passing the Sample/Custom Test cases does not guarantee the correctness of code. On submission, your code is tested against multiple test cases consisting of all possible corner cases and stress constraints.
You can access the hints to get an idea about what is expected of you as well as the final solution code.
You can view the solutions submitted by other users from the submission tab.