You are given an integer 'N'.
Return the summation of its multiplication table up to 10.
Let 'N' = 5.
The multiplication table of 5 up to 10 is: 5, 10, 15, 20, 25, 30, 35, 40, 45, 50.
The summation is 5 + 10 + 15 + 20 + 25 + 30 + 35 + 40 + 45 + 50 = 275.
Therefore, the answer is 275.
The first line contains a single integer 'N'.
Output Format :
Return the summation of the multiplication table of 'N' up to 10.
Note :
You don’t need to print anything. Just implement the given function.
1 <= 'N' <= 1000
Time Limit: 1 sec
7
385
The multiplication table of 7 up to 10 is: 7, 14, 21, 28, 35, 42, 49, 56, 63, 70.
The summation is 7 + 14 + 21 + 28 + 35 + 42 + 49 + 56 + 63 + 70 = 385.
Thus, the answer is 385.
1
55
Recognize that the summation of the multiplication table can be expressed using the distributive property of multiplication over addition.
Approach:
Algorithm:
O(1).
The calculation involves a constant number of arithmetic operations, independent of the value of 'N'. Thus, the overall time complexity is of the order O(1).
O(1).
We are only using a few constant space variables to store the result. Thus, the overall space complexity is of the order O(1).