While Loop

Given a digit d (0 to 9), find the sum of the first 50 positive integers (integers > 0) that end with digit d.

A number ends with digit d if its last digit is d.

Example 1:

Input: d = 1

Output: 12300

Explanation:

The first 50 positive integers ending with 1 are: 1, 11, 21, 31, ..., 491

Their sum is 12300.

Example 2:

Input: d = 5

Output: 12500

Now Your Turn!

Pick the correct output for the given input

Input: d = 2

Still unsure what the problem is asking ?

Let’s go through a few more examples, step by step, to make it clearer.

Constraints:

  • 0 <= d <= 9
0
class Solution {
public:
int whileLoop(int d) {
// Your code goes here
}
};
Test Case

Input:

D