While loop Demo
#include <iostream> using namespace std; int main(void) { int num; cout << "Enter a positive number: "; cin >> num; while (num <= 0) { cout << "Positive number: "; cin >> num; } cout << "The number you entered is " << num << " "; return 0; }