|Write a program to find the sum of digits of a giv...|General Coding Problems

fn sum_of_digits(n: i64) -> i32

Easy

Write a program to find the sum of digits of a given number.

fn sum_of_digits(n: i64) -> i32

Asked in

wipro

Examples

Example 1:
Input: 12345
Output: 15
Example 2:
Input: 0
Output: 0
Submit Result

Click Run to test sample cases, or Submit to evaluate all cases