Answer to Question #297908 in C++ for Rain Capisonda

Question #297908

Using while loop, write a C++ program that will allow the users to enter the number of quizzes to compute and the program will automatically compute the average of the quizzes.


Sample Output:



Output:


Enter Number of Quiz: 4


Quiz 1: 90

Quiz 2: 89

Quiz 3: 94

Quiz 4: 100


Average: 93


1
Expert's answer
2022-02-15T09:32:11-0500


#include <iostream>
#include <iomanip>


using namespace std;


int main()
{
	int numberQuiz;
	cout<<"Enter Number of Quiz: ";
	cin>>numberQuiz;
	float sum=0;
	float quiz;
	int i=0;
	while(i<numberQuiz){
		cout<<"Quiz "<<(i+1)<<": ";
		cin>>quiz; 
		sum+=quiz; 
		i++;
	}
	cout<<"\nAverage: "<<(int)sum/numberQuiz<<"\n\n";


	system("pause");
	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