Integer Digits Count

Published by ch47longhorn in

Create a function that counts the integer's number of digits.

Examples

count(318) ➞ 3
 
count(-92563) ➞ 5
 
count(4666) ➞ 4

count(-314890) ➞ 6

count(654321) ➞ 6

count(638476) ➞ 6

Notes

  • For an added challenge, try to solve this without using strings.
  • Optionally, you can solve this via a recursive approach.
  • A recursive version of this challenge can be found here.
Watch a quick demo on how Edabit works.