76 389
Assignments Done
Successfully Done
In May 2019

Answer to Question #13090 in C++ for rochielle quita

Question #13090
write a program that reads in a list of integer values , entered one per line, and outputs the average of the integer entered. the program asks the user how many numbers will be on the list and uses this value to control the loop that reads in the numbers. this program need not echo the input
Expert's answer
#include <iostream.h>

int i, num, arr[100], *a;
double avg=0;

void main(){
cout<<"how many numbers will be on the list? ";
cout<<"enter "<<num<<" numbers, please:\n";
for(i=0;i<num;i++) { cin>>*a; a++; }
for(i=0;i<num;i++) avg+=arr[i];
avg = avg/num;
cout<<"the average is "<<avg<<"\n";

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions