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

Write a program that reads 10 numbers from the screen, calculates the mean (aver

ID: 3793512 • Letter: W

Question

Write a program that reads 10 numbers from the screen, calculates the mean (average), finds the minimum and maximum values, and outputs them to the screen. You have to use array s to solve this question. Write a program to swap the contents of two integer arrays of six elements. The output of your program should clearly show original array contents and the result. For example, the output might look as follows: Contents of array A before swap: 1 2 3 4 5 6 Contents of array B before swap: 7 8 9 10 11 12 Contents of array A after swap: 7891011 12 Contents of array B after swap: 1 2 3 4 5 6 Note that your program not only just outputs as above, but actually swap the contents of two integer arrays. Also, you can initialize the two arrays directly: array A with 1 ~ 6 and array B with 7 ~ 12. Submitting the homework: Students should finish ALL the assignments INDIVIDUALLY! Follow die Assignment submission guidelines in the Syllabus, except paper: submission guideline. DO NOT submit C source code files, like program1.c, but put all the answers in one document file.

Explanation / Answer

#include<stdio.h>
int main(){
   int arr[10];
   int sum=0;
   double avg;
   int max=0,min=0;
   printf(" enter 10 numbers : ");
   for(int i=0;i<10;i++)
   {
   scanf("%d",&arr[i]);
   if(arr[i]>max)max=arr[i];
   if(arr[i]<min)min=arr[i];
   sum=sum+arr[i];
}
avg=sum/6;
printf(" max : %d min : %d sum : %d avg : %f",max,min,sum,avg);
  
int arr1[]={1,2,3,4,5,6};
int arr2[]={7,8,9,10,11,12};
printf(" elements before swapping array 1 ");
for(int i=0;i<6;i++){
   printf("%d",arr1[i]);
   }
   printf(" array 2");
   for(int i=0;i<6;i++){
   printf("%d",arr2[i]);
   }
for(int i=0;i<6;i++){
   int temp;
   temp=arr1[i];
   arr1[i]=arr2[i];
   arr2[i]=temp;
   }
   printf(" elements after swapping array 1 ");
for(int i=0;i<6;i++){
   printf("%d",arr1[i]);
   }
   printf(" array 2");
   for(int i=0;i<6;i++){
   printf("%d",arr2[i]);
   }
   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