While loop is another loop like for loop but unlike for loop it only checks for one condition.
Here, we will use while loop and print a number n's table in reverse order.
Example 1:
Input: n = 1
Output: 10 9 8 7 6 5 4 3 2 1
Example 2:
Input: n = 2
Output: 20 18 16 14 12 10 8 6 4 2
Video:
Your Task:
You don't need to read anything. Your task is to complete the function printTable() which takes n as the input parameter and prints the table in reverse order with spaces and a newline character at the end.
 
Expected Time Complexity: O(n)
Expected Space Complexity: O(1)
Constraints:
1 ≤ n ≤ 1000

Source: geeksforgeeks | Difficulty: EASY

Starter code: #User function Template for python3



class Solution:

    def printTable(self, n):

        multiplier = 10

        while(multiplier):

            # Code here

        print()

Solutions:
class Solution:

	def printTable(self, n):
		multiplier = 10
		while multiplier:
			print(multiplier * n, end=' ')
			multiplier = multiplier - 1
		print()


class Solution:

	def printTable(self, n):
		c = n * 10
		i = 1
		j = c
		a = []
		while i <= 10:
			a.append(j)
			i = i + 1
			j = j - n
		print(*a)


class Solution:

	def printTable(self, n):
		b = []
		for i in range(1, 11):
			b.append(n * i)
		for i in reversed(b):
			print(i, end=' ')
		print()
		return


class Solution:

	def printTable(self, n):
		m = 10
		while m >= 1:
			print(m * n, end=' ')
			m = m - 1
		print()


class Solution:

	def printTable(self, n):
		for i in range(n * 10, n - 1, -n):
			print(i, end=' ')
		print()


class Solution:

	def printTable(self, n):
		n = int(n)
		list1 = list(range(1, 11))
		list1.reverse()
		k = list(map(lambda x: x * n, list1))
		print(*k)


class Solution:

	def printTable(self, n):
		mul = 10
		while mul:
			print(n * mul, end=' ')
			mul -= 1
		print()


class Solution:

	def printTable(self, n):
		multiplier = 10
		a = []
		b = 1
		while multiplier != 0:
			a.append(b * n)
			b += 1
			multiplier -= 1
		l = a[::-1]
		print(*l)


class Solution:

	def printTable(self, n):
		multiplier = 10
		t = []
		while multiplier:
			t.append(multiplier * n)
			multiplier -= 1
		print(*t, sep=' ')


class Solution:

	def printTable(self, n):
		multiplier = 10
		result = multiplier * n
		while result >= n:
			print(result, end=' ')
			result -= n
		print()


class Solution:

	def printTable(self, n):
		multiplier = 10
		while multiplier >= 1:
			print(multiplier * n, end=' ')
			multiplier = multiplier - 1
		print()
if __name__ == '__main__':
	T = int(input())
	for i in range(T):
		n = int(input())
		obj = Solution()
		obj.printTable(n)