Print the table (Math Set-2)

less than 1 minute read

Problem

Print the table of a given number N.

Input: First line contains an integer, the number of test cases ‘T’. T testcases follow. Each testcase cotains one line of input denoting N.

Output: For each testcase, print the table of N upto 10.

Constraints:

1 <= T <= 100

1 <= N <= 1000

Example:

  • Input:

1

9

  • Output:

9 18 27 36 45 54 63 72 81 90

My Solution

t= int(input())
def printTable(n):
    for i in range(1, 11):
        print(n*i, end=' ')
    print()
    return ''

for i in range(t):
    n= int(input())
    printTable(n)

O(\(n\))

Categories:

Updated:

Leave a comment