Sort by

recency

|

1658 Discussions

|

  • + 0 comments
    using namespace std;
    int main() {
        unsigned int a;
        unsigned int b;
        string s_arr[] = {"one","two","three","four","five","six","seven","eight","nine"};
        
        cin >> a;
        cin >> b;
        
        for(; a <= b; ++a){
            if(a <= sizeof(s_arr)/sizeof(s_arr[0])) cout << s_arr[a-1] << endl;
            if(a > sizeof(s_arr)/sizeof(s_arr[0])){
                if((a%2) == 0) cout << "even\n";
                else cout << "odd\n";
            }
        }
        
        return 0;
    }
    
  • + 0 comments

    int n, m; cin >> n >> m;

    for (int i = n; i <= m; i++) {
        if (i == 1) {
            cout << "one" << endl;
        }
        else if (i == 2) {
            cout << "two" << endl;
        }
        else if (i == 3) {
            cout << "three" << endl;
        }
        else if (i == 4) {
            cout << "four" << endl;
        }
        else if (i == 5) {
            cout << "five" << endl;
        }
        else if (i == 6) {
            cout << "six" << endl;
        }
        else if (i == 7) {
            cout << "seven" << endl;
        }
        else if (i == 8) {
            cout << "eight" << endl;
        }
        else if (i == 9) {
            cout << "nine" << endl;
        }
        else {
            if (i % 2 == 0) {
                cout << "even" << endl;
            }
            else {
                cout << "odd" << endl;
            }
        }
    }
    
  • + 0 comments
    int main() {
        
        int i;
        int j;
        cin >> i;
        cin >> j;
        string numbers[10] = {"zero","one","two","three","four","five","six","seven","eight","nine"};
        
        for(int a = i; a <= j; a++){
            if (a >= 0 && a <= 9) {
                cout << numbers[a] << "\n";
            }else if(a % 2 == 0){
                cout << "even\n";
            }else{
                cout << "odd\n";
            }
        }
        return 0;
    }
    
  • + 0 comments
    #include <iostream>
    
    using namespace std;
    
    void printNumberRepresentation(int n);
    bool isEven(int n);
    
    int main()
    {
        unsigned int a, b;
        cin >> a;
        cin >> b;
    
        for (int n = a; n <= b; n++)
        {
            printNumberRepresentation(n);
        }
    }
    
    void printNumberRepresentation(int n)
    {
        switch (n)
        {
        case 1:
            cout << "one";
            break;
        case 2:
            cout << "two";
            break;
        case 3:
            cout << "three";
            break;
        case 4:
            cout << "four";
            break;
        case 5:
            cout << "five";
            break;
        case 6:
            cout << "six";
            break;
        case 7:
            cout << "seven";
            break;
        case 8:
            cout << "eight";
            break;
        case 9:
            cout << "nine";
            break;
        default:
        {
            if (isEven(n))
                cout << "even";
            else
                cout << "odd";
            break;
        }
        }
        cout << endl;
    }
    
    bool isEven(int n)
    {
        return n % 2 == 0 ? true : false;
    }
    
  • + 0 comments

    include

    using namespace std;

    int main() { string words[] = {"one","two","three","four","five","six","seven","eight","nine"}; int a, b; cin >> a >> b; for(int i = a; i <= b; i++) { if(i >= 1 && i <= 9) cout << words[i-1] << endl; else if(i % 2 == 0) cout << "even" << endl; else cout << "odd" << endl; } return 0; }