/* File: countdown.c
 * 
 * A very simple recursive function.
 */

#include <stdio.h>
#include "genlib.h"
#include "simpio.h"

void countdown(int) ;

main() {
   int n ;

   printf("Engaging the auto-destruct sequence\n") ;
   printf("Enter number of seconds to auto-destruct: ") ;
   n = GetInteger() ; 
   printf("Counting down from %d\n", n) ;
   countdown(n) ;
}


/* This is a simple recursive function
*/
void countdown(int k) {
  
  if (k == 0) {
     printf("KABOOM!!!\n") ;
  } else {
     printf("   %d seconds to auto-destruct\n", k) ;
     countdown(k-1) ;
  }
}

