loop assignment
Tue Oct 10 2023 11:03:31 GMT+0000 (Coordinated Universal Time)
Saved by
@akaeyad
#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;
}
content_copyCOPY
Comments