0
How can i get the Thousands, hundreds, tens, ones, from user input? Using array in C#
5 Answers
+ 1
public static void split(int n)
{
if(n<10){
Array.add(arr, n);
break;
// break is to end this
}
else{
Array.add(arr, n%10);
split(n/10);
}
}
12376 will give [6,7,3,2,1]
+ 1
what is the name array? variable?
+ 1
for example in 182376
in if 182376>10 so else will work
put 182376%10=6 inside arr=[6];
then do same for 18237
now process will repeat and same thing happen with smaller no.
so it will make arr=[6,7,3,2,8]
now one last digit it is <10 so 1 will be written
arr=[6,7,3,2,8,1]
+ 1
I changed the name to arr
arr is the name of array where values are being added after splitting digits
0
what is Array.add? cant find this code. String[] Arr. add is cant find