Answered step by step
Verified Expert Solution
Question
1 Approved Answer
9. The purpose of the following program is to generate 10 random integers, store them in an array, and then store in the freq frequency
9. The purpose of the following program is to generate 10 random integers, store them in an array, and then store in the freq frequency array, the number of occurrences of each number from 0 to 9. Can you find any errors in the program? If yes, correct them. #include #include #include #define SIZE 10 int main(void) int i, num, arr[SIZE], freq[SIZE]; srand (time (NULL)); arr[1] rand(); SIZE; for(i i i++) num arr[i]; freq[num]++; printf("InNumber occurrences In"); for(i = 0; SIZE; i++) printf("%d appears %d times ", i, freq[i]); return 0
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started