I need the whole pseudocode for this C program: #include<stdio.h> void printarra
ID: 3759581 • Letter: I
Question
I need the whole pseudocode for this C program:
#include<stdio.h>
void printarray(int array[], int asize){
int i;
for(i = 0; i < asize;i++)
printf("%d", array[i]);
printf(" ");
}
int sum(int array[], int asize){
int result = 0;
int i = 0;
for(i=0;i < asize;i++){
result = result + array[i];
}
return result;
}
int swap( int* pA,int*pB){
int result = 0;
if(*pA > pB){
int tamp = *pA;
*pA = *pB;
*pB = tamp;
result = 1;
}
return result;
}
int sort_1pass(int array[], int asize){
int result = 0;
int i;
for(i=0;i < asize-1;i++){
result = result + swap(&array[i], &array[i+1]);
}
return result;
}
void sort(int array[],int asize){
int result = 1;
while(result!=0){
result = 0;
result = sort_1pass(array, asize);
printarray(array, asize);
}
}
int main(){
int array[] ={8,1,8,2,0,3,1,9,8};
int size = 9;
printarray(array, size);
printf("The sum is%d ", sum(array, size));
sort(array, size);
printarray(array, size);
printf("The median is: %d ", array[size / 2]);
printf("The average is %0.2lf ",(double)sum(array, size)/size);
}
Explanation / Answer
Solution:
************
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.