0

hi I need a program in C++ that returns the number by only integers; for exmaple if you input a numbre X= 43756, the program will show:
6
5
7
3
4

and it will also show the number:
4
3
7
5
6.


Please someone help me

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by myk45
0

Try this:

/* let n be the input variable */
while (n != 0) {
   num = n % 10; // gives the last digit
   arr[i++] = num; // store result in an array
   n /= 10;
}

/* print the array. You get the first output. Print it in reverse and you get the   
 * second output 
 */
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.