In this lab we are going to work on a little program with a loop that (1) asks the "user" if they want to countdown and (2) does a countdown.
Start with the following program, which has some bugs, and try to get in running correctly.
#include <stdio.h> int main(void) { int start, n ; char ans ; ans = '?' ; while (ans != 'n') { do { printf("Do you wish to continue: [y or n]\n") ; scanf("%c", &ans) ; scanf("%*c") ; } while (ans != 'y' && ans != 'n') ; printf("Enter a positive number:\n") ; scanf("%d", &start) ; for(n=start; n>=0; --n) printf("%3d\n", n) ; } return(0) ; }