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 :
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 numbers into the array, computes their average, and finds out how many numbers are above the average. Make sure to include pointer syntax. Example output: Enter array size: 10 10 random numbers between 1 and 10 generated are: 2 8 5 1 10 5 9 9 3 5 The average is: 5.7 Number of items above the average = 4 C++ Code only.
Write a program that reads two integer values. It then calculates and displays the sum and average of all values between them, Le. if the first value is vi and the second value is 2, then the program calculates and displays the sum and average of all values in the closed range Iv1,2 Your Program must satisfy the following constraints: A. make sure that v1 is less than 2 B. Use a function named getStats(that takes two integer yalues as...
I need to Write a test program that prompts the user to enter 10 double values into an array, calls a method to calculate the average of the numbers, and displays the average. Next, write a method that returns the lowest value in the array and display the lowest number. The program should then prompt the user to enter 10 integer values into an array, calculates the average, and displays the average. The program should have two overloaded methods to...
2. Write a program that reads N integer numbers of array from the user and then displays the sum, max number and the numbers of the array use four subroutines ( Read_Array(), Calculate_Sum(), Find_Max() and Display_Array()). Here is sample output Please enter number of elements: 4 Please enter the required numbers: 50 100 150 20 The entered numbers are: 50 100 150 20 Sum is : 320 Max is 150 by Mpsi ,sum and max to call subroutine and retrieve...
Write a program that reads an unknown number (but no more than 100) of integer values from a file (“ass5_Q4_input.txt”), and displays distinct numbers. (i.e. if a number appears multiple times, it is displayed only once.)
In C++ Write a function that receives an integer array with its size and determines whether the array is already sorted in increasing order. Write a test program (main function) that prompts the use to enter a list and displays whether the list is sorted or not. The first number in the input indicates the size of the list. Assume the maximum list size is 20.
In C++ Write a function that receives an integer array with its size and determines whether the array is already sorted in increasing order. Write a test program (main function) that prompts the use to enter a list and displays whether the list is sorted or not. The first number in the input indicates the size of the list. Assume the maximum list size is 20.
Write a C++ program that does the following : 1. Accepts array size from the keyboard. The size must be positive integer that is >= 5 and <= 15 inclusive . 2. Use the size from step 1 in order to create an integer array. Populate the created array with random integer values between 10 and 200. 3. Display the generated array. 4. Write a recursive function that displays the array in reverse order . 5. Write a recursive function...
C++ Problems: 1. Write a program that reads in an array of user given size n and then it reads several increment values terminated by 0. The program calls each time a function incarray() that accepts an array A, its size S and an increment value inc and updates yje array by incrementing all its values by the passed value of inc. The program prints out the array after each update. 2. write a program that reads in a n...
c++ Write a program that reads 10 marks of type float, store them in an array, then the program will 4 determine the number of marks greater than the average. Write a program that reads 10 marks, store them in an array, then the program will print the .5 array in reverse order.