how to easily print all digits from one to ten in words! A trick to remember in C programming!

 #include <stdio.h> 

int main(){

int i,begin,end;

scanf("%d%d",&begin,&end);

char* str[]={"one","two","three","four","five","six","seven","eight","nine"};

for(i=begin;i<=end;i++)

{

    if(i<=9)

    {

        printf("%s\n",str[i-1]);

    } else if (i>9 )

    {

       if(i%2==0)

       {

           printf("even\n");

       } else

       {

           printf("odd\n");

       }

    }

}

return 0;}

//Mashrafe

Comments