|Jun6-12, 06:22 PM||#18|
Ok I already see a problem. I put the & signs in the printf command.
It seems like it's working. 3 spaces are supposed to be between the digits.
int d1, d2, d3, d4, d5;
printf("Enter a number between 1 and 32767: ");
d1 = num / 10000;
d2 = (num / 1000) %10;
d3 = (num / 100) %10;
d4 = (num / 10) %10;
d5 = (num % 10);
printf("%d %d %d %d %d\n", d1, d2, d3, d4, d5);
printf("%d %d %d %d\n", d2, d3, d4, d5);
printf("%d %d %d\n", d3, d4, d5);
printf("%d %d\n", d4, d5);
I think I'm supposed to separate the first part from the second part in two different functions. Like, for example, the part where the printing is done should be in a second function. I'm not sure how to do that. Do I like define the function at the top and then use that same definition after the first function or something?
|Similar Threads for: Fibonacci sequence|
|Sequence analysis of the Fibonacci sequence using matrices?||Calculus & Beyond Homework||7|
|Fibonacci sequence||Calculus & Beyond Homework||5|
|Fibonacci sequence||Brain Teasers||22|
|The Fibonacci Sequence||Linear & Abstract Algebra||6|
|Fibonacci Sequence||Introductory Physics Homework||13|