Practice

Count Digits in a Number

EASYLoops5 marks

Read a non-negative integer and output how many digits it contains.

The value 0 has one digit.

Input: One non-negative integer. Output: The number of digits.

Example:

Input:  48291
Output: 5
Premium is coming soon. All grading features are currently unlocked.

Sample Test Cases

Test 1: Five-digit number
Inputs: 48291
Expected: 5
Test 2: Single digit
Inputs: 7
Expected: 1