Answer to Question #104848 in C++ for Carlo

Question #104848
Letran 2020
How many numbers you want to enter:

Enter number 1 :: 2
Enter number 2 :: 3
Enter number 4 :: 8
Enter number 5 :: 1


Sum of numbers :: 18
Average of 5 Numbers :: 3.6
1
Expert's answer
2020-03-08T18:46:37-0400


#include<iostream>
using namespace std;
int main()
{
	int count_numbers=0;
	cout<<"How many numbers you want to enter:";
	cin>>count_numbers;


	int number=0;
	int sum=0;
	for(int i=0;i<count_numbers;++i){
		cout<<"Enter number "<<i+1<<"::";
		cin>>number;
		sum+=number;
		}
	cout<<"Sum of numbers::"<<sum<<endl;
	cout<<"Average of "<<count_numbers<<" Numbers"<<"::"<<double(sum)/count_numbers;
	return 0;
}




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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS