You are given a two-digit integer n. Return the sum of its digits.

You are given a two-digit integer n. Return the sum of its digits.

Example

For n = 29, the output should be

solution(n) = 11.

Input/Output

[execution time limit] 4 seconds (js)

[input] integer n

A positive two-digit integer.

Guaranteed constraints:

10 ≤ n ≤ 99.

[output] integer

The sum of the first and second digits of the input number.

[JavaScript] Syntax Tips

// Prints help message to the console

// Returns a string

function helloWorld(name) {

    console.log(“This prints to the console when you Run Tests”);

    return “Hello, ” + name;

}

Solution

About admin

Check Also

Given an array of integers a, your task is to count the number of pairs i and j (where 0 ≤ i < j < a.length), such that a[i] and a[j] are digit anagrams.

Given an array of integers a, your task is to count the number of pairs …

Leave a Reply

Your email address will not be published.