I am having trouble with the following question...
"write a method displayDigits that receives an integer between 1 and 99999 and displays it as a sequence of digits, separating each pair of digits by two spaces. For example, the integer 4562 should appear as 4 5 6 2"
This is what I have currently, I know it displays the numbers backwards, but won't compile with a "error: missing return statement"
error.
public static int displayDigits(int num1)
{
for (int i=0; num1>0; i++)
{
return(num1 % 10)
}
}
The book noted that we only use %
and /
to solve the problem. Help please!! I've been working on this for hours...