Sort by

recency

|

827 Discussions

|

  • + 0 comments

    void check_digit(int x) { if ((x >= 1) && (x <= 9)) { if (x == 1) { puts("one"); } else if (x == 2) { puts("two"); } else if (x == 3) { puts("three"); } else if (x == 4) { puts("four"); } else if (x == 5) { puts("five"); } else if (x == 6) { puts("six"); } else if (x == 7) { puts("seven"); } else if (x == 8) { puts("eight"); } else if (x == 9) { puts("nine"); } } if (x > 9) {
    if ((x % 2) == 0) { puts("even"); } else { puts("odd"); } } }

    int main() { int a, b; scanf("%d\n%d", &a, &b);

    for (int i = a; i <= b; i++) {
        check_digit(i);
    }
    return 0;
    

    }

  • + 0 comments
    char representation[9][10] = {"one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
        for(int i=0; a+i <= b; i++) {
            printf("%s\n", a+i<=9 ? representation[a+i-1] : (a+i) % 2 ? "odd" : "even");
        }
    
  • + 0 comments

    char arr[][10] = {"one", "two", "three", "four", "five", "six", "seven", "eight", "nine"}; for (int i = a; i<=b; i++){ if (i<=9){ printf("%s\n", arr[i-1]); } else { printf(((i%2)==0)? "even\n": "odd\n"); } }

  • + 0 comments
    _Bool iseven(int value){
        return value % 2 == 0;
    }
    
    
    int main() 
    {
        int a, b;
        scanf("%d\n%d", &a, &b);
      	// Complete the code.
        for (int i=a; i<=b; i++){
            if (i <=9){
                if (i == 1) printf("one\n");
                if (i == 2) printf("two\n");
                if (i == 3) printf("three\n");
                if (i == 4) printf("four\n");
                if (i == 5) printf("five\n");
                if (i == 6) printf("six\n");
                if (i == 7) printf("seven\n");
                if (i == 8) printf("eight\n");
                if (i == 9) printf("nine\n");
            } else if (iseven(i)){ 
            printf("even\n");
            } else {
                printf("odd\n");
            }
        }
        
        return 0;
    }
    
  • + 0 comments
    #include <string.h>
    #include <math.h>
    #include <stdlib.h>
    
    
    
    int main() 
    {
        int a, b;
        scanf("%d\n%d", &a, &b);
        char number[9][6]={"one","two","three","four","five","six","seven","eight","nine"};
        int i;
        for (i=a;i<=b;i++){
            if(i>=1 && i<=9)
            printf("%s\n",number[i-1]);
            else if(i>9){
                if(i%2==0)
                    printf("even\n");
                else
                    printf("odd\n");
            }
        }
        return 0;
    }