Question: In C programming language Write a program that declares an array of ten integers and fills it with random values that are between 1 and
In C programming language
Write a program that declares an array of ten integers and fills it with random values that are between 1 and 5, inclusive, using the 'rand ()' function. The program should ask the user for a 'key' and print the indices of the first and last occurrences of the key in the array. The program should also print the total number of times the key shows up in the array. This is sample output. Array data 1, 2, 5, 4, 2, 3, 3, 4, 5, 2. Enter the key: 2 First occurrence at index: 1 Last occurrence at index: 9 Total number of occurrences: 3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
