All challenges
Easy 0 solved 0% acceptance

Multiplication Table Row

List the first multiples of a number.

Problem

Build one row of a multiplication table: number × 1, number × 2, … up to number × count.

Implement multiplication_row(number, count).

Input

number: The number to multiply. count: How many multiples to list.

Output

Return the list of multiples in order.

Constraints

-1,000 ≤ number ≤ 1,000; 0 ≤ count ≤ 100

Examples

Example 1
Input:
count = 5
number = 3

Expected output:
expected = [3, 6, 9, 12, 15]
Input:
long long count = 5;
long long number = 3;

Expected output:
std::vector<long long> expected = {3, 6, 9, 12, 15};
Input:
long count = 5;
long number = 3;

Expected output:
long[] expected = new long[] {3, 6, 9, 12, 15};

Explanation

3×1, 3×2, 3×3, 3×4, 3×5 = 3, 6, 9, 12, 15.

Example 2
Input:
count = 0
number = 7

Expected output:
expected = []
Input:
long long count = 0;
long long number = 7;

Expected output:
std::vector<long long> expected = {};
Input:
long count = 0;
long number = 7;

Expected output:
long[] expected = new long[] {};

Explanation

Zero multiples were requested, so the list is empty.

References

This challenge is adapted for CodeUtility. Follow the statement and constraints above.

Learn from others

Community solutions

No published solutions yet. Solve this challenge to share the first one.