1

Write a program that first reads an integer for the array size, then reads double values...

Question

Write a program that first reads an integer for the array size, then reads double values...

Write a program that first reads an integer for the array size, then reads double values into the array, and displays the num

Write a program that first reads an integer for the array size, then reads double values into the array, and displays the number of values greater than the average. Enter array size: 6 Enter a number: 1.1 Enter a number: 2.2 Enter a number: 3.4 Enter a number: 3.9 Enter a number: 5.5 Enter a number: 8.75 The number of values greater than the average is 2

Answers

Solution :

#include<iostream>
using namespace std;

int main()
{
   int n;
   cout<<"Enter array size: ";
   cin>>n;
   double arr[n], sum = 0;

// read values from user and store it to array and calculate sum of elements
   for(int i=0; i<n; i++){
       cout<<"Enter a number: ";
       cin>>arr[i];
       sum = sum + arr[i];
   }

// calculate average
   double avg = sum / 6;
   int count = 0;

// count number of elements greater than average
   for(int i=0; i<n; i++)
       if(arr[i] > avg)
           count++;
   cout<<"The number of values greater than the average is "<<count<<endl;      
   return 0;
}

SCREENSHOT :

:: 0 :: * dh TDM-GCC 4.9.2 32-bit Release WC:\Users\USER\Documents\New folder onlyC++.cpp - [Executing) - Dev-C++ 5.11 File E

C:\Users\USER\Documents\New folder\onlyC++.exe Enter array size: 6 Enter a number: 1.1 Enter a number: 2.2 Enter a number: 3.


Similar Solved Questions

1 answers
2 7. Order: 2 strength Sustacal 300 mL po. gitd.
2 7. Order: 2 strength Sustacal 300 mL po. gitd....
1 answers
Show all work OUE rate is 10 percent? 20 percent? eISIUNS nder the NPV rule in...
show all work OUE rate is 10 percent? 20 percent? eISIUNS nder the NPV rule in part (d) consistent w LISIRR Consider the following ca er the NPV rule in part (d) consistent with those of the IRR rule? NPV versus eation Corporation. Both projects require an annual return of 15 percent. sh flows on tw...
1 answers
Which of the terms are included in the equation for the Solow model's aggregate production function?...
Which of the terms are included in the equation for the Solow model's aggregate production function? A. incentives B. natural resources C. human capital D. physical capital...
1 answers
Help Save & Exit Submit Required information The following information applies to the questions displayed below....
Help Save & Exit Submit Required information The following information applies to the questions displayed below. Part 2 of 2 Delph Company uses a job order costing system and has two manufacturing departments-Molding and Fabrication. The company provided the following estimates at the beginning ...
1 answers
Presented below is information related to Pharoah Company. Oct. 1 2 3 Diane Lexington begins business...
Presented below is information related to Pharoah Company. Oct. 1 2 3 Diane Lexington begins business as a real estate agent with a cash investment of $20,700 in exchange for common stock. Hires an administrative assistant. Purchases office furniture for $1,800, on account. Sells a house and lot for...
1 answers
I like to get teas passage,questions and answers on solar panel and chimney swift
I like to get teas passage,questions and answers on solar panel and chimney swift...
1 answers
Your answer is partially correct. Try again. In the figure here, a red car and a...
Your answer is partially correct. Try again. In the figure here, a red car and a green car move toward each other in adjacent lanes and parallel to an x axis. At time t = 0, the red car is at xp = 0 and the green car is at xg = 225 m. If the red car has a constant velocity of 25.0 km/h, the cars pas...
1 answers
Question 1 (Marks: 35) Create a class named Customer that will determine the monthly repayment amount...
Question 1 (Marks: 35) Create a class named Customer that will determine the monthly repayment amount due by a customer for a product bought on credit. The class has five fields: customer name, contact number, product price, number of months and the monthly repayment amount. Write get and set method...
1 answers
The estimated annual cash flow of an investment project along with associated probabilities are given below....
The estimated annual cash flow of an investment project along with associated probabilities are given below. Determine the expected present worth of this annual cash flow series at an interest rate of 11% per year. Year P = 0.5 P = 0.4 P = 0.1 0 ($57,000) ($59,000) ($57,500) 1 $3100 $3000 $...
1 answers
Circuits. Quality control. During a final inspection of circuits, circuits that are not fully functional should...
Circuits. Quality control. During a final inspection of circuits, circuits that are not fully functional should be sorted out. It is known that on average 20% the generated circuits are not fully functional. When testing, 95% of these circuits are sorted out, but also 1% of the perfect ones. 1. What...
1 answers
Ending December 31, 2017. Assume a tax rate of 40 percent. the asset as an epense,...
ending December 31, 2017. Assume a tax rate of 40 percent. the asset as an epense, the 2. The 3. The company recorded advances of $10,500 to employees made December 31, 2017 as Salaries and Wages Expense. 4. Dividends of $10,500 during 2017 were recorded as an operating expense. cost method. The new...
1 answers
2. Jack and Rose attend a lecture about the contributing factors for interoceanic passenger ship accidents....
2. Jack and Rose attend a lecture about the contributing factors for interoceanic passenger ship accidents. The lecture shows regression results on severity of the accident (Y) and water temperatures (X). Rose believes that, because most ships travel through certain routes, temperatures (X) is highl...
1 answers
Consider the system shown in the figure (Figure 1) with MA = 7.5 kg and mB...
Consider the system shown in the figure (Figure 1) with MA = 7.5 kg and mB = 11.0 kg. The angles QA = 59. and OB = 32. a) In the absence of friction, what force F would be required to pull the masses at a constant velocity up the fixed inclines? MB CB = 32° b) The force Fº is now removed. W...
1 answers
Suppose your statistics professor reports test grades as z-scores, and you got a score of 1.79...
Suppose your statistics professor reports test grades as z-scores, and you got a score of 1.79 on an exam. a) Write a sentence explaining what that means b) Your friend got a z-score of-1. If the grades satisty the Nearty Normal Condition, about what percent of the class scored lower than your fiend...
1 answers
Part A 40 Ar, Enter your answers numerically separated by commas. P, n, e- Submit Incorrect;...
Part A 40 Ar, Enter your answers numerically separated by commas. P, n, e- Submit Incorrect; Try Again; 6 attempts remaining; no points deducted Your answer does not have the correct number of comma-separated terms. X Part B 65Zn, Enter your answers numerically separated by commas. P, n, e- Submit R...
1 answers
A solution NaOH(aq) contains 8.0 g NaOH(s) per 100.0 mL of solution. Calculate the pH and...
A solution NaOH(aq) contains 8.0 g NaOH(s) per 100.0 mL of solution. Calculate the pH and the pOH of the solution at 25 °C. pH = 14.3 pOH = -1.6...
1 answers
73. A hoop of radius R rotates at constant an- gular velocity 12. A small bead...
73. A hoop of radius R rotates at constant an- gular velocity 12. A small bead of mass m is attached to the hoop, with a frictional force on the bead proportional to the dif- ference in velocity between the bead and edge of the hoop, F = k(RS2 - Rw), where w is the angular velocity of the bead. If t...
1 answers
(100 points) Figure below shows the schematic diagram of a two-stage cascade refrigeration system (also called...
(100 points) Figure below shows the schematic diagram of a two-stage cascade refrigeration system (also called the Economizer 2-Stage Refrigeration Cycle). Comparing to the cascade two-stage refrigeration system discussed in In-class Activity #10a, in this case, the flash chamber (now called Flash I...

-- 0.032737--