Menu
Coddy logo textTech

Number of digits

Lesson 16 of 32 in Coddy's Coding Problems course.

Write a program that will calculate the number of digits that a number has.

challenge icon

Challenge

Medium

Write a function named numberOfDigits that given a natural number N from input. Output the number of digit that N has.

 

Input
3

Output
1

Input
100

Output
3

Try it yourself

int numberOfDigits(int a1) {
    // Write code here
}

All lessons in Coding Problems