Skip to content

Instantly share code, notes, and snippets.

@Mozart2234
Last active October 20, 2017 23:31
Show Gist options
  • Save Mozart2234/069161ea34a7f927c4c1aaa13ec5b5f4 to your computer and use it in GitHub Desktop.
Save Mozart2234/069161ea34a7f927c4c1aaa13ec5b5f4 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;
while(temp < x){
cout << temp << endl;
if(temp < 10){
temp++;
}
else if(temp < 20 && temp >= 10){
temp +=2;
}
else if(temp < 30 && temp >= 20 ){
temp +=3;
}
else{
temp++;
}
}
temp = x;
while(temp > i){
if(temp < 10){
temp--;
}
else if(temp < 20 && temp >= 10){
temp -=2;
}
else if(temp < 30 && temp >= 20 ){
temp -=3;
}
else{
temp--;
}
cout << temp << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment