60 347
Assignments Done
98%
Successfully Done
In April 2018

Answer to Question #57641 in C++ for Sajid 8

Question #57641
Q. Write a program that inputs 10 floating point numbers in an array. It displays the values which are greater than the average value of the array.
Expert's answer
#include <iostream>


int main()
{
double array[10];
double avarage = 0;

std::cout << "Please, enter 10 floating point numbers:" << std::endl;
for(int i = 0; i < 10; i++)
{
std::cin >> array[i];
avarage += array[i];
}
avarage = avarage / 10;

std::cout << std::endl << "Values which are greater than the average value of the array:" << std::endl;

for(int i = 0; i < 10; i++)
{
if ( array[i] > avarage )
{
std::cout << array[i] << std::endl;
}
}
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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions