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
MediumWrite 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
1Course Introduction
Introduction3Medium Difficulty
Candy BarsFibonacci NumbersFactorialNumber of digitsLeast common multipleLargest sumNotebookApplesGiftsDog yearsAnagrams