Conditional Statements in C

  • + 0 comments

    include

    include

    int main() { int a; scanf("%d", &a);

    // Corrected number array
    char *number[] = {"one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
    
    // Check if the input is between 1 and 9
    if (a >= 1 && a <= 9) {
        printf("%s\n", number[a - 1]);
    } 
    else {
        printf("Greater than 9\n");
    }
    
    return 0;
    

    }