Skip to content

Add two 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 ​

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.

Solution ​

Solution
rust
fn solution(n: i32) -> i32 {
    (n/10) + (n % 10)
}
fn solution(n: i32) -> i32 {
    (n/10) + (n % 10)
}