|
CS256 - Principles of Structured Design
Fall 2021
|
Displaying ./code/sternflCode/h4/countdown.c
/*
countdown.c
In this program, you will get a number from the user, and then you will print
the numbers counting down from that number to 1. After the loop finishes, just
print "Done"
*/
#include <stdio.h>
int main(){
int start; //variable declaration
//ask the user where you want to start
printf("Where do I start the countdown?> ");
scanf("%d", &start);
//tell the user that the countdown is starting
printf("Starting Countdown...\n");
/*
set up a loop that starts at the given starting point, and counts down
until we reach 1. We want to keep looping as long as the number is
bigger than 0.
Hint: if i++ adds 1 to whatever is in i, what would subtract 1 from i?
Also, make sure each number has it's own line.
*/
//loop goes here
//then after you finish, just print "Done" and a newline.
return 0;
}
|