#include <iostream>
#include <limits>

int main() {
    int user_number = 0;
    
    std::cout << "Please enter a positive whole number (e.g., 5, 10): ";
    
    while (!(std::cin >> user_number) || user_number <= 0) {
        std::cout << "Invalid input! Please enter a POSITIVE whole number: ";
        
        std::cin.clear();
        std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
    }
    
    std::cout << "\nValid number received: " << user_number << std::endl;
    std::cout << "Now, I will use a for loop to count down from your number:\n";

    for (int i = user_number; i > 0; i--) {
        std::cout << "Countdown: " << i << std::endl;
    }
    
    std::cout << "Blast off!\n";

    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: