csansoon

P2.04 P97156 Numbers in an interval

Sep 21st, 2018
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.22 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. int main() {
  6.     int a, b, n;
  7.     cin >> a >> b;
  8.     if (a<=b) {
  9.         n=a;
  10.         while (n<b) {
  11.             cout << n << ",";
  12.             n++;
  13.         }
  14.         cout << n << endl;
  15.     }
  16.     else {
  17.         cout << endl;
  18.     }
Advertisement
Add Comment
Please, Sign In to add comment