// program to print all the numbers from the first to the second. #include <iostream> using namespace std; int main() { int first; int second; int current; cout << "Enter first number -- "; cin >> first; cout << "Enter second number -- "; cin >> second; // using a while loop current = first; while (current <= second) { cout << current << ' '; current = current + 1; } cout << endl; // using a do-while loop current = first; do { if (current <= second) { cout << current << ' '; current++; } } while (current <= second); cout << endl; // using a for loop for(current = first; current <= second; current++) cout << current << ' '; cout << endl; // without using current while (first <= second) { cout << first << ' '; first = first + 1; } cout << endl; return 0; }