1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
nydimaria [60]
4 years ago
9

Create a program that asks the user to enter grade scores. Use a loop to request each score and add it to a total. Continue acce

pting scores until the user enters a negative value. Finally, calculate and display the average for the entered scores.
Computers and Technology
1 answer:
fomenos4 years ago
6 0

Answer:

total = 0

count = 0

while(True):

   grade = float(input("Enter a grade: "))

   if grade < 0:

       break

   else:

       total += grade

       count += 1

       

average = total/count

print("The average is: " + str(average))

Explanation:

*The code is in Python.

Initialize the total and count as 0

Create a while loop that iterates until a specific condition is met inside the loop

Inside the loop, ask the user to enter a grade. If the grade is smaller than 0, stop the loop. Otherwise, add the grade to the total and increment the count by 1.

When the loop is done, calculate the average, divide the total by count, and print it

You might be interested in
Select the correct answer. Which of these statements is an explorer most likely to make?​
Varvara68 [4.7K]

Answer:

Then it would be D for your answer. :)

Explanation:

please mark brainliest! :)

and have a great day!

3 0
3 years ago
The statement x++;
natita [175]

Answer:

The correct option for the given question is option(A) i.e Increments the value currently stored in the variable x and stores that new value back in the variable x.

Explanation:

x++ is an  increment operator Their are two types of increment operator

1.Post increment

2.Pre increment.

Post increment operator assign the value first to variable then increment the value by 1.

for example

int a=7,t;

t=a++; //post increment

Pre increment operator first  increment the value by 1 then store into variable.

int  a=7,t;

t=++a; // Pre increment.

So the correct answer is option(a)

8 0
3 years ago
Assume you are given a boolean variable named isNegative and a 2-dimensional array of ints that has been created and assigned to
Anon25 [30]

Answer:

#include <iostream>

using namespace std;

int main(){

   int rows, cols;

   bool isNegatives;

   cout<<"Rows: ";

   cin>>rows;

   cout<<"Columns: ";

   cin>>cols;

   int a2d[rows][cols];

   for(int i =0;i<rows;i++){

   for(int j =0;j<cols;j++){

       cin>>a2d[i][j];}    }

   int negatives, others = 0;

   for(int i =0;i<rows;i++){

   for(int j =0;j<cols;j++){

       if(a2d[i][j]<0){

           negatives++;}

       else{

           others++;}}    }

   if(negatives>others){

       isNegatives = true;}

   else{

       isNegatives = false;}

   cout<<isNegatives;  

   return 0;

}

Explanation:

For clarity and better understanding of the question, I answered the question from the scratch.

This line declares number of rows and columns

   int rows, cols;

This line declares the Boolean variable

   bool isNegatives;

This line prompts user for rows

   cout<<"Rows: ";

This line gets the number of rows

   cin>>rows;

This line prompts user for columns

   cout<<"Columns: ";

This line gets the number of columns

   cin>>cols;

This line declares the array

   int a2d[rows][cols];

This line gets user input for the array

<em>    for(int i =0;i<rows;i++){</em>

<em>    for(int j =0;j<cols;j++){</em>

<em>        cin>>a2d[i][j];}    }</em>

This line declares and initializes number of negative and others to 0

   int negatives, others = 0;

The following iteration counts the number of negatives and also count the number of non negative (i.e. others)

<em>    for(int i =0;i<rows;i++){</em>

<em>    for(int j =0;j<cols;j++){</em>

<em>        if(a2d[i][j]<0){</em>

<em>            negatives++;}</em>

<em>        else{</em>

<em>            others++;}}    }</em>

This checks of number of negatives is greater than others

   if(negatives>others){

If yes, it assigns true to isNegatives

       isNegatives = true;}

   else{

If otherwise, it assigns false to isNegatives

       isNegatives = false;}

This prints the value of isNegatives

   cout<<isNegatives;  

<em>See attachment</em>

Download cpp
5 0
3 years ago
What is achieved through xylography
ryzh [129]
As a relief method, it is only necessary to ink the block and bring it into firm and even contact with the paper or cloth to achieve an acceptable print.
4 0
3 years ago
Read 2 more answers
____ is one of the primary operations of a computer.
Romashka [77]
Processing <span>is one of the primary operations of a computer.</span>
7 0
3 years ago
Other questions:
  • A user has a new web email account and asks a technician for help with setting up email on a tablet. The user would like for the
    11·1 answer
  • Which result would support the particle theory of light?
    6·2 answers
  • System A has two processors. Program X takes 50 seconds to execute on one of the processors. Program Y takes 50 seconds to execu
    8·1 answer
  • Sonja is writing a program to compare two numbers and print the larger number. Which of these should be used?
    6·1 answer
  • What can help you estimate how much money you might get in
    7·1 answer
  • OkkKkkkkkEYEYYEYEYEY BYEYYEYEYEyeeyeyyeEYEy if you know you know
    11·1 answer
  • Write a program in Python to sum to numbers:<br><br> Urgently needed, please.
    14·1 answer
  • Assume a large shared LLC that is tiled and distributed on the chip. Assume that the OS page size is 16KB. The entire LLC has a
    8·1 answer
  • What is the output of the following code?int *p; int *q; p = new int; *p = 43; q = p;*q = 52; p = new int; *p = 78; q = new int;
    5·1 answer
  • How can you make your MakeCode micro:bit program display either the letter<br> A or the letter B?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!