Activity: Countdown! (iPad)

The Assignment

Working with your partner, write a C++ program which inputs simple integer and outputs a list of values from the input variable (called “counter”)  down to 0 (not including 0). You should only show every other value in the output, starting with the input value. For example, if the input value is 23, the output would be 23, 21, 19, 17, …., 3, and 1. You must use a for loop.

Begin by creating a new C++ file called Countdown.cpp in the iPad C++ compiler. Next, copy and paste this starter code into the file:

#include <iostream>
#include <iomanip>

using namespace std;

int main() 
{
   // declare storage for the counter...
   int counter = 0;
   
   // input the value...
   cin >> counter;
   
   /*
      Loop through the numbers from "counter" down to but not including
      zero (0), only printing every other value (e.g. 500, 498, 496...)
   */


   // return "success" to the operating system (OS)...
   return 0;
}

Modify the code to complete the assignment. When you have completed the assignment, demonstrate it for the instructor.