nathan_step_size

mail@pastecode.io avatar
unknown
c_cpp
2 years ago
620 B
4
Indexable
Never
#include <iostream>

using namespace std;

int main()
{
    int numStart, numLim, numSkip;


    cout << "Enter starting number: ";
    cin >> numStart;
    cout << "Enter limit number: ";
    cin >> numLim;
    cout << "Enter Step Size number: ";
    cin >> numSkip;

    if (numStart < numLim){
        for (int i = numStart; i <= numLim; i++){
            if (i % numSkip == 0){
                if(numSkip % 2 == 0){
                    cout << i-1 << endl;
                } else {
                    cout << i << endl;
                }
            }   
         }
    }
    return 0;
}