How can I convert an no. into digits in array,ex. If i get 1234 as a number i need to get itas single digits 1,2,3,4 in array? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can I convert an no. into digits in array,ex. If i get 1234 as a number i need to get itas single digits 1,2,3,4 in array?

Input-1234 (Add number in second and fourth place 2+4=6) Output-6

6th Feb 2020, 6:11 AM
R.Abinaya
R.Abinaya - avatar
1 Answer
+ 3
There a lot of ways you can do that, some might need a couple of conversion steps to be performed. From string to int or vice-versa. Try what ~ swim ~ has mentioned. If you still struggle then let us know.
6th Feb 2020, 7:24 AM
Avinesh
Avinesh - avatar