Develop a program to meet the following requirements: Must use at least two func
ID: 3611973 • Letter: D
Question
Develop a program to meet the following requirements: Must use at least two functions (not counting main) Must use indirection (the * operator) Must use a conditional loop Your assignment is to take any number of positive integers as input, compare them and output the smallest and largest. You must also calculate the average value of all the integers, and output that average as a float. Use the following integers, plus others as you see fit: 12 22 18 402 98 34 71 63 4 89 Hints: You can use a negative integer to terminate input One function to average, another to output final resultsExplanation / Answer
please rate - thanks #include #include void minmax(int*,int*,int); void out(int,int,float); int main() {int min=9999,max=-999,num,sum=0,count=0; float average; printf("Enter a number: "); scanf("%d",&num); while(num>=0) {minmax(&min,&max,num); sum+=num; count++; printf("Enter a number: "); scanf("%d",&num); } average=sum/(float)count; out(min,max,average); getch(); return 0; } void minmax(int * min,int* max,int num) { if(num*max) *max=num; return; } void out(int min,int max, float avg) {printf("The smallest number was %d ",min); printf("The largestest number was %d ",max); printf("The average was %f ",avg); return; }Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.