/* This program will just print the numbers 20 19 18 17 16 15 ... 3 2 1 0, but it could be used as the basis for something useful */ void count_down_from(int n) // negative n values not expected { print(n); new_line(); if (n>0) count_down_from(n-1); } void main() { count_down_from(20); } /* the key to understanding it is this: how do you count down from 20? You say "20" and then count down from 19. you need to keep in mind that that is only the correct answer for reasonable numbers like 20. For zero the answer is different. How do you count down from 0? You just say "0" and that's all. */ /* This version counts in the right direction. How do you count up to 20? First you count up to 19, then you just say "20". */ void count_up_to(int n) // negative n values not expected { if (n>0) count_up_to(n-1); } print(n); new_line(); } void main() { count_up_to(20); }