#include <iostream>
#include <stdexcept>
#include <limits>
using namespace std;

int main(){
	cout << "Natural Numbers Less than n \n";
	cout << "To exit: n < 0 \n\n";
	while (true) {
		try{
			int m;
			int n;
			cout << "m = ";
			cin >> m;
			if (cin.fail()){
				throw invalid_argument("Error! You have to enter integers!");
			}
			cout << "n = ";
			cin >> n;
			if (cin.fail()){
				throw invalid_argument("Error! You have to enter integers!");
			}
			if (n == m) {
	    	break;
			}
		    if (n < m) {
				int temp = m;
				m = n;
				n = temp;
			}
			cout << "Natural Numbers between " << m << " & " << n << ": \n";
		    for (int i=m+1; i<n; i++) {
		    	cout << i << endl;
			}
			cout << endl;
		} catch (const invalid_argument& e){
			cin.clear(); 
            cin.ignore(numeric_limits<streamsize>::max(), '\n'); 
			cout << e.what() << endl << endl;
		}
	}
	return 0;
}
