• + 1 comment

    I wanted to print it out like this printf("%s",a<=9?num[a-1]: a%2==0?"even\n":"odd\n" but it does not work, do you know why?

    #include <stdio.h>
    #include <string.h>
    #include <math.h>
    #include <stdlib.h>
    
    
    
    int main() 
    {
        int a, b;
        scanf("%d\n%d", &a, &b);
      	// Complete the code.
          char *num[]={"one","two","three","four","five","six","seven","eight","nine"};
        for(a;a<=b;a++)
        {
            if(a<=9)
                printf("%s\n", num[a-1]);
            else{
                if(a>9)
                    if(a%2==0)
                        printf("even\n");
                    else
                        printf("odd\n");
            }    
        }
    
        return 0;
    }