#include <iostream> using namespace std; int main() { int n1; int n2; cout << "Type Your Range Numbers\n"; cin >> n1; cin >> n2; if (n1 > n2) { for (int i = (n2 + 1); i < (n1 + 1); i++) { if (i % 2 != 0) { cout << i << "\n"; } cout << "=================\n"; } } if (n1 < n2) { for (int i = (n1 + 1); i < (n2 - 1); i++) { if (i % 2 != 0) { cout << i << "\n"; } cout << "=================\n"; } } /*for (int i = (n1 + 1); i < (n2 - 1); i++) { if (i % 2 != 0) { cout << i << "\n"; } cout << "=================\n"; } */ /* Test Case 1 Number One: 1 Number Two: 9 Output: 3, 5, 7 Test Case 2 Number One: 2 Number Two: 15 Output: 3, 5, 7, 9, 11, 13 Test Case 3 Number One: 8 Number Two: 2 Output: 3, 5, 7 */ return 0; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter