Write a function that takes a number and returns an array of
its digits. So, for 2342 it should return 2,3,4,2

Please read the Daniweb Posting Rules and Suggestions For Posting Questions.

What language are you writing it in and what do you have so far? There are different techniques depending on the actual specs. If you are reading in the number, you can process it as a string. To convert a string in Python into a list of chars is a one-liner using a list comprehension.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.