Sort by

recency

|

860 Discussions

|

  • + 0 comments

    That simple version and u dont need to handling every case. If u have any qs I'am Here.

    #include <stdio.h>
    int main(void)
    {
        int a, b;
        scanf("%d\n%d", &a ,&b);
        const char *nbword[10] = {"zero", "one", "two", "three", "four" ,"five", "six", "seven" ,"eight", "nine"};
        
        int i = a;
        while (i <= b)
        {
            if (i >= 1 && i <= 9)
                printf("%s\n", nbword[i]);
            else 
            {
                if (!(i % 2 == 0))
                    printf("odd\n");
                else
                    printf("even\n");
            }
            i++;
        }
    

    }

  • + 0 comments
    /*  I am sharing my solution to this challenge. Any comments are welcome, as they help me improve. Thank you. */
    
    #include <stdio.h>
    
    int main() {
        int a, b;
        scanf("%d\n%d", &a, &b);
        
        for (short i = a; i <= b; i++) {
            
            switch (i) {
                case 1:
                    printf("one\n");
                    break;
                case 2:
                    printf("two\n");
                    break;
                case 3:
                    printf("three\n");
                    break;
                case 4:
                    printf("four\n");
                    break;
                case 5:
                    printf("five\n");
                    break;
                case 6:
                    printf("six\n");
                    break;
                case 7:
                    printf("seven\n");
                    break;
                case 8:
                    printf("eight\n");
                    break;
                case 9:
                    printf("nine\n");
                    break;
                default:
                    if (i % 2 == 0) {
                        printf("even\n");
                    } else {
                        printf("odd\n");
                    }
                    break;
            }
        }
    
        return 0;
    }
    
  • + 0 comments

    Penetration testing is one of the most effective ways to uncover hidden security risks before attackers do. A must-have for any serious cybersecurity strategy.

  • + 0 comments

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

    }
    return 0;
    

    }

  • + 0 comments

    Is the expected output wrong here? 3 is an odd number, the sequence should start with "odd" not even.

    Input: 3, 15

    Expected Output:

    Three, Four, Five, Six, Seven, Eight, Nine, Even, Odd, etc...