Skip to content

Instantly share code, notes, and snippets.

@Mozart2234
Created October 20, 2017 23:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mozart2234/3b89a1e10353d28c8a25069df0011c19 to your computer and use it in GitHub Desktop.
Save Mozart2234/3b89a1e10353d28c8a25069df0011c19 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int main() {
int i;
int x;
cout << "Ingrese un valor: ";
cin >> i;
cout << "Ingrese otro valor mayor que el primero: ";
cin >> x;
int temp = i;
int temp2 = x;
bool turn = true;
while(temp != x || temp2 != i) {
if(turn){
cout << temp << endl;
temp +=2;
}
else{
temp2 -=2;
cout << temp2 << endl;
}
turn = !turn;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment