Sort by

recency

|

849 Discussions

|

  • + 0 comments
    #include<stdio.h>
    
    int main()
    {
        int a, b;
        char word[10][10] = {"zero","one","two","three","four","five","six","seven","eight","nine"};
        
        scanf("%d", &a);
        scanf("%d", &b);
        
        for(int n=a;n<=b;n++)
        {
            if(n>=0 && n<=9)
                printf("%s\n",word[n]);
            else if(n % 2 == 0)
                printf("even\n");
            else
                printf("odd\n");
        }
        
        return 0;
    }
    
  • + 0 comments
    #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 *number[] = {"one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
        char *evenness[] = {"even", "odd"};
        
        for(int i = a; i < b+1; i++) printf("%s\n", (i < 10) ? number[i-1] : evenness[i % 2]);
    
        return 0;
    }
    
  • + 0 comments
    int main() 
    {
        int a, b;
        scanf("%d\n%d", &a, &b);
      	// Complete the code.
        char *arr[] = {"one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
        
        for (int i = a; i <= b; i++) {
            if (i <= 9)
                printf("%s\n", arr[i - 1]); 
            else {
                if (i % 2 == 0)
                    printf("even\n"); 
                else
                    printf("odd\n");  
            }
        }
        return 0;
    }
    
  • + 0 comments

    gfvdddddddddrrrrrrrrrr

  • + 0 comments

    It's great for beginners to grasp the fundamental concept, and this description helps demystify the structure and flow of the for loop in programming. Well done! ekbet 40