We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
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>intmain(){inta,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");elseprintf("odd\n");}}return0;}
For Loop in C
You are viewing a single comment's thread. Return to all comments →
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?