Sort by

recency

|

867 Discussions

|

  • + 0 comments

    include

    include

    include

    include

    int main() { int a, b,i; const char *words[] ={"zero","one","two","there","four","five","six","seven","eight","nine","ten"}; scanf("%d\n%d", &a, &b); // Complete the code. for(i=a;i<=b;i++) { if(i>=0 && i<=9){ printf("%s\n",words[i]); } else { printf("%s\n",(i%2==0)?"even":"odd"); } } why hidden task are fielded even all program is right?

    return 0;
    

    }

  • + 0 comments

    For Loop in C.

    Here is my Solution :

    #include <stdio.h>
    
    int main() {
    
        int frst, scnd, i;
    
        scanf("%d %d", &frst, &scnd);
    
        i = frst;
    
        for ( ; i <= scnd; ++i) {
            
            if (i == 1) printf("one\n");
            else if (i == 2) printf("two\n");
            else if (i == 3) printf("three\n");
            else if (i == 4) printf("four\n");
            else if (i == 5) printf("five\n");
            else if (i == 6) printf("six\n");
            else if (i == 7) printf("seven\n");
            else if (i == 8) printf("eight\n");
            else if (i == 9) printf("nine\n");
            else if (i % 2 == 0) printf("even\n");
            else printf("odd\n");
        }
    
        return 0;
    }
    
  • + 0 comments

    include

    include

    include

    include

    int main() { int a, b; scanf("%d\n%d", &a, &b); // Complete the code.

    for(int i=a;i<=b;i++){
    
        if(i >= 1 && i <= 9){
            if(i==1)
                printf("one");
            else if(i==2)
                printf("two");
            else if(i==3)
                printf("three");
            else if(i==4)
                printf("four");
            else if(i==5)
                printf("five");
            else if(i==6)
                printf("six");
            else if(i==7)
                printf("seven");
            else if(i==8)
                printf("eight\n");
            else if(i==9)
                printf("nine\n");
            }
        else{
                if(i%2==0)
                    printf("even\n");
    
                else 
                    printf("odd");
    
         }
    
    
    }
    
    
    
    
    
    return 0;
    

    }

  • + 0 comments
    int main() 
    {
        int a, b;
        scanf("%d\n%d", &a, &b);
      	// Complete the code.
    char *number[10``]={"zero","one","two","three","four","five","six","seven","eight","nine"}; 
    
    for(int i= a; i <= b ;i++){
        if(i >=1 && i <=9)
        printf("%s\n",number[i]);
        else{
            if(i%2==0)
            printf("even\n");
            else
             printf("odd\n");
        }
    }
    
        return 0;
    }
    
  • + 0 comments

    Using a for loop in C helps me handle repetitive tasks easily, kind of like following viper plays where every moment matters. Setting the loop correctly makes the process smooth, and it’s satisfying to see each step run exactly as planned. It feels practical and keeps things simple, which makes coding less frustrating.