fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int a,b;
  6. cin >> a >> b;
  7. if(a > b){
  8. int temp = a;
  9. a = b;
  10. b = temp;
  11. }
  12. for(int i = a;i <= b;i++){
  13. cout << i << " ";
  14. }
  15.  
  16. return 0;
  17. }
Success #stdin #stdout 0.01s 5276KB
stdin
4 1
stdout
1 2 3 4