Challenge: Countdown

Lab C++ Beginner 10 points

Read a number n and count down from n to 1, each number on its own line. Then print Go!

Input

One integer n (1 or more).

Output

n lines of numbers, then Go!

Example

Input

3

Output

3
2
1
Go!
Sample input available Sample output available
Editor
C++

Hints

Start the loop at n and use i-- to go down.

Keep going while i >= 1.

Solution explanation

A for loop that starts at n and steps down by one each round.

Show solution
#include <iostream>
using namespace std;

int main() {
    int n;
    cin >> n;
    for (int i = n; i >= 1; i--) {
        cout << i << "\n";
    }
    cout << "Go!\n";
    return 0;
}
Output
Answer
HOME LABS COMMUNITY DASHBOARD