Advertisement
fiqriachmada

PraktikumModulIILooping

Nov 22nd, 2018
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.  int x, y, z;
  8.  
  9.  do{
  10.     cout << "X : ";
  11.     cin >> x;
  12.     cout << "Y : ";
  13.     cin >> y;
  14.  
  15.     if(x<=y)
  16.         break;
  17.  }while(true);
  18.  
  19.  z=0;
  20.  
  21.  for (int i = x; i <= y; i++){
  22.     if(i>=0){
  23.         cout << i << " ";
  24.  
  25.     }
  26.     else{
  27.         cout << i << " ";
  28.     }
  29.  
  30.     z=z;}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement