program to display numbers from an interval

How can i create a program to display numbers from given interval cin>>a , cin>>b, with for loop?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <iostream>

int main()
{
	int a {}, b {};

	std::cout << "Enter two numbers (first lower than second): ";
	std::cin >> a >> b;

	for (int c = a; c <= b; ++c)
		std::cout << c << ' ';

	std::cout << '\n';
}

thanks

Topic archived. No new replies allowed.