Write a function that receives a positive integer and display each digit of such integer one digit per line. For example, if the integer the function receives 2475, then it should display the digits of this number as following:
5
7
4
2
I'm doing an exercises from my book, I need help with them to check my work.
Nobody can help you to check your work if you have not done any work to check.
You must write a function. Function must take an integer parameter. Function must print something. What should the function return?
What mean I? Lets rephrase:
If you have in code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
int number = 47;
int foo = number % 10;
// What is the value of foo now?
int bar = number / 10;
// What is the value of bar now?
// Do you know this construct?
while ( condition )
{
// statements
}