Answer:
#include <stdio.h>
int main()
{
int numbers[10];
int k;
for (int i = 0; i < 10; i++) {
printf("Enter a number: ");
scanf("%d", &numbers[i]);
}
printf("Which number you want to print[1-10]? ");
scanf("%d", &k);
printf("The %d. number is %d", k, numbers[k-1]);
return 0;
}
Step-by-step explanation:
Declare an array named numbers that has a size of ten and an integer named k
Create a for loop that iterates 10 times. Inside the loop, ask the user to enter the numbers for the array and put them in the array
When the loop is done, ask the user to enter which number to print and print the number
Note that, since index starts at 0, the 5. element is at index 4. That is why we need to subtract 1 from k when specifying the index.