227k views
1 vote
Write a program whose input is two integers, and whose output is the first integer and subsequent increments of 5 as long as the value is less than or equal to the second integer C++

1 Answer

1 vote

Answer:

#include <iostream>

using namespace std;

int main() {

int start, end;

cout << "Enter start number: ";

cin >> start;

cout << "Enter end number: ";

cin >> end;

for(int n=start; n<=end; n+=5) {

cout << n << " ";

}

}

Step-by-step explanation:

I output the numbers space separated.

User Misco
by
5.8k points