You are viewing a single comment's thread. Return to all comments →
using namespace std;
int main() { // char arr[10] = {"zero", "three", "four","five","six", "seven", "eight","nine"};
int a,b; cin >> a >> b; for(int i = a; i<=b; i++){ if(i <= 9){ // cout<< " "<<endl; // continue; switch(i){ case 0: if(i == 0) cout<< "zero"<< endl; //break; case 1: if(i == 1) cout<< "one"<< endl; break; case 2: if(i == 2) cout<< "two"<< endl; break; case 3: if(i == 3) cout<< "three"<< endl; break; case 4: if(i == 4) cout<< "four"<< endl; break; case 5: if(i == 5) cout<< "five"<< endl; break; case 6: if(i == 6) cout<< "six"<< endl; break; case 7: if(i == 7) cout<< "seven"<< endl; break; case 8: if(i == 8) cout<< "eight"<< endl; break; case 9: if(i == 9) cout<< "nine"<< endl; break; } } else if(i > 9 && i%2 == 0){ cout << "even" << endl; } else{ cout << "odd" << endl; } } return 0;
}
Seems like cookies are disabled on this browser, please enable them to open this website
For Loop
You are viewing a single comment's thread. Return to all comments →
include
include
using namespace std;
int main() { // char arr[10] = {"zero", "three", "four","five","six", "seven", "eight","nine"};
}