+ 3

Need to separate numbers

Need to separate numbers. (For example) Int A=256; 2 5 6 Thank you very much

9th Feb 2018, 8:39 PM
William Torf
William Torf - avatar
3 odpowiedzi
+ 16
divide the number by increasing 10^n //n goes from number of digits to 1 //thats basic approach , or u can convert no. to String & use charAt ()
9th Feb 2018, 8:56 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 2
In javascript : var number = 256;//or an input from the user number = '' + number; var result = number.split('');//split is a method to separate a string into an array using a separator (no separator = separate every character) Hope that it will help you
9th Feb 2018, 8:48 PM
Αητοιπe
Αητοιπe - avatar