Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write and test a C program that lets a user interactively manipulate an array (A

ID: 3889125 • Letter: W

Question

Write and test a C program that lets a user interactively manipulate an array (A) holding 49 integers Commands to the program are integers that should be interpreted as follows 0 Quit the program 1. Fill A with zeroes 2. Generate 49 random integers and store in A. Each integer is greater than 3. 4. 5. or equal to 0 and less than 10. See Program 1 for information about random number generation Output the contents of A, 7 numbers to a line Display the contents of A as a histogram (see example program run) Report the mean, median and standard deviation of contents of A add the following command 6. Report the length and location of the longest sequence of identical integers. (If there are two or more longest sequences, identify the first one.)

Explanation / Answer

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main()
{
int A[49];
int ch;
int i=0, sum =0;
float mean;
do{
printf("Enter choice:");
scanf("%d", ch);
switch(ch){
case 0:
break;
return 0;
case 1:
for(i=0;i<49;i++)
A[i] = 0;
break;
case 2:
srand(time(NULL));
for(i=0;i<49;i++){
A[i] = rand() % 10;
}
break;
case 3:
for(i=0;i<49;i++){
if(i%7==0)
printf(" ");
else
printf("%d", A[i]);
}
break;
case 5:
for(i=0;i<49;i++){
sum = sum + A[i];
}
  
mean = sum /49;
printf("Mean is %f", mean);
}
}while(1 == 1);

return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote