Welcome

DIGITS AND NUMBER (PRACTICE)

level

  • Basic
  • Beginner
  • Intermediate
  • Mixed
  • Advanced

Automated grading of homework assignments and tests

  • fork this repository
  • solve the task
  • commit with proper message
  • just push and check answer

Problems

Sum of digits #1

A integer is given. Find the sum of digits in it.

Example 1:

Input: num=5
Output: 5

Example 2:

Input: num=23
Output: 5

Example 3:

Input: num=200
Output: 2

Constraints:

  • 0<=num<=105

Get length #2

A integer is given. Find the number of digits in it.

Example 1:

Input: num=5
Output: 1

Example 2:

Input: num=87
Output: 2

Constraints:

  • 0<=num<=105

Warning

  • don't copy other solutions or any solution
  • don't remove comments