write a program that reads in a list of integer values, entered one per line, and outputs the averege of the integers 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.
1
Expert's answer
2012-08-21T10:45:38-0400
#include<conio.h> #include <iostream> using namespace std; int main() { int n; int arrayofintegervalue[1000]; cout<<"How many numbers will be on the list?: "; cin>>n; for(int i=0;i<n;i++){ cout<<"Enter integer value "<<(i+1)<<": "; cin>>arrayofintegervalue[i]; } int sum=0; double average=0; for(int i=0;i<n;i++){ sum+=arrayofintegervalue[i]; } average=sum/n; cout<<"Average = "<<average; cout<<" Press any key to exit"; getch(); return 0; }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment