Skip to main content

problem on loop

 


#include<stdio.h>
int main()
{
    int n,m;
    scanf("%d %d",&n,&m);
    do{
        switch(n)
    {
        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;
    }
     n++;
    }while(n<m+1);

   if(m>9)
   {
        for(int i=10;i<=m;i++)
      {
       if(i%2==0)
       printf("even\n");
       else
       printf("odd\n");
      }
   }


}

Comments

Popular posts from this blog

example of typecasting in c

/*Type Casting in C Typecasting allows us to convert one data type into other. */ //simple example to cast int value into the float. #include <stdio.h>    int   main (){   float   f = ( float ) 9 / 4 ;     printf ( "f : %f \n " ,  f  );     return   0 ;   }