Question
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 ma
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Ans 4.)

#include<iostream>
using namespace std;

int main(){
float arr[10],sum=0,avg;
cout<<"Enter 10 marks: \n";
for(int i = 0; i < 10; i++){
        cin >> arr[i]; // input number
        sum += arr[i]; // sum number
}
avg = sum/10.0; // find avg
int count = 0;
for(int i = 0; i < 10; i++){
        if(arr[i] > avg){
            count++;   // count number of marks greater
       }
}
cout<<"Average: "<<avg<<endl; // you can remove it
cout<<"Number of marks greater than average: "<<count;
return 0;
}

#include<iostream> using namespace std; int main({ float arr[10], sum=0, avg; cout<<Enter 10 marks: \n; for(int i = 0; i <1

/*OUTPUT */

Enter 10 marks: 2.5 6.4 3.9 4.5 1.2 3.8 5.6 4.8 9.8 10.5 Average: 5.3 Number of marks greater than average: 4 -- --------- Pr

Ans 5)

#include<iostream>
using namespace std;

int main(){
float arr[10],avg; // CREATE VARIABLE
cout<<"Enter 10 marks: \n"; // ASK USER
for(int i = 0; i < 10; i++){ //
        cin >> arr[i]; // input number
}
cout<<"Array in raverse order:\n";
for(int i = 9; i >= 0; i--){ // print reverse array store from 0 to n-1
        cout<<arr[i]<<endl;
}
return 0;
}

/* OUTPUT */

Enter 10 marks: 3.2 5.6 9.4 5.9 2.3 6.4 15.7 3.89 14.8 4.7 Array in raverse order: 4.7 14.8 3.89 15.7 6.4 2.3 5.9 9.4 5.6 3.2

/* PLEASE UPVOTE */

Add a comment
Know the answer?
Add Answer to:
c++ Write a program that reads 10 marks of type float, store them in an array,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Pointer tasks: ( In C++ ) 1. Write a program to store the address of a...

    Pointer tasks: ( In C++ ) 1. Write a program to store the address of a character variable and a float variable. • Print the address of both variables. • Print the values of variable using dereference operator. • Add 2 in float value using pointer. • Print address of character variable using reference operator. 2. Write a program that takes 5 elements in an array and print them in reverse order using pointers. 3. Write to program that takes...

  • Write a C++ program that reads in 6 elements from the keyboard and stores them in...

    Write a C++ program that reads in 6 elements from the keyboard and stores them in an array x[6]. It should then create a second array y[6] that contains the elements from x in reverse order and with the s Tsecond - Tsmallest shown below. A sample run should look like: rocted ITrom it (e.g., Jlast first Tsmallest Vsecond last , etc). The program should finally print out both arrays to screen, in the format Enter 6 array elements: 4...

  • Q1. CLO: (5 points) Write a java program that reads 10 words from the keyboard then...

    Q1. CLO: (5 points) Write a java program that reads 10 words from the keyboard then place them in an array. Display the array elements in reverse order, and then count and print the number of times a word appears in that array. The user shall insert the word from the keyboard.

  • 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 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

  • Write a program that first reads an integer for the array size, then reads numbers into...

    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 in c programming Write a C program that reads in up to 10 numbers into...

    write in c programming Write a C program that reads in up to 10 numbers into an array. The program should count the number of duplicate elements within that array and print the result. Example test data and expected output is given below Test Data: [2,1,1,2,1,3, 4] Duplicates:

  • Consider the following program that reads students’ test scores into an array and prints the contents of the array. You will add more functions to the program. The instructions are given below.

    Consider the following program that reads students’ test scores into an array and prints the contents of the array.   You will add more functions to the program.  The instructions are given below.              For each of the following exercises, write a function and make the appropriate function call in main.Comments are to be added in the program. 1.       Write a void function to find the average test score for each student and store in an array studentAvgs. void AverageScores( const int scores[][MAX_TESTS],                       int...

  • Write a C program that reads in the file and outputs it to another file with...

    Write a C program that reads in the file and outputs it to another file with its lines in reverse order. Use the following array to store the addresses of the lines as you read them in: char *lines[200]; Save each line so that it occupies only enough memory required by that line. Use recursion. Hint: On each call of the recursive function, read ONE line into a LOCAL buffer.

  • Write a C PROGRAM that will read in 10 floating-point numbers from the keyboard and load...

    Write a C PROGRAM that will read in 10 floating-point numbers from the keyboard and load them into an array. Add up all the values and store the answer in a variable. Find the largest and smallest number in the array. Put each into its own variable. Print to the screen the sum, largest value, and smallest value. Copy the array to a second array in reverse order. Print out the second array. Read in 20 integer numbers, all in...

  • Write a program that reads 2 doubles, 2 float, and 4 integers and prints them four...

    Write a program that reads 2 doubles, 2 float, and 4 integers and prints them four in a line separated by tabs or spaces. The user should be prompted for input with a suitable instruction and the output should line up to the right. The numerical output should also have a minimum width of 5 and a precision of 2 decimal places to the right of the decimal. In C programming

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT