// Your task is to write a small C program called phone.c that uses scanf to read two values from standard input. 
#include <stdio.h>

int main() {
    char phone[11];
    printf("Type in a phone number:\n");
    fgets(phone, 11, stdin);

    int number;
    printf("Type in a number:\n");
    scanf("%d", &number);
    
    if (number == -1){
        printf("%s\n", phone);
    }
    else if ((0 <= number)&&(number <= 9)){
        printf("%d\n", phone[number]);
    }
    else {
        printf("ERROR");
        return 1;
    }

    return 0;
}
Your task is to write a small C program called phone.c that uses scanf to read two values from standard input. The first is a 10 character string and the second is an integer. The program takes no command-line arguments. (You will write this program from scratch, so remember to add, commit, and push.)

If the integer is -1, the program prints the full string to stdout. If the integer i is between 0 and 9, the program prints only the corresponding character (i.e., at index i) from the string to stdout. In both of these cases the program returns 0.

If the integer is less than -1 or greater than 9, the program prints the message "ERROR" to stdout and returns 1.