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
antiseptic1488 [7]
3 years ago
8

You want to know your grade in Computer Science, so write a program that continuously takes grades between 0 and 100 to standard

input until you input "stop", at which point it should print your average to standard output.
Computers and Technology
1 answer:
Dominik [7]3 years ago
6 0

Answer:

Following are the program in the Python Programming Language.

#declare variables and initialize to 0

s=0

n=0

avg=0

#set the infinite while loop  

while(True):

 #get input from the user

 score=input()

 #set if statement to break loop

 if(score =="stop"):

   break

 #otherwise, perform calculation

 else:  

   n+= 1

   s=s+ int(score)

   avg= s/n

#print average of the input

print ('average: ',avg)

<u>Output</u>:

58

96

34

15

stop

average:  50.75

Explanation:

<u>Following are the description of the program</u>.

  • Firstly, set three variable that is 's' for sum, 'n' for count and 'avg' for average and initialize them to 0.
  • Set the infinite while loop and inside it, set variable 'score' that get input from the user then, set the if conditional statement for break the loop, otherwise we calculate the sum of the user input and calculate its average.
  • Finally, we print the result with message.
You might be interested in
Dimensional arrays can be created using loops. 2 dimensional arrays can be created using:
Hunter-Best [27]

Answer:

b-Nested Loops

Explanation:

To create a 1-D array we use single loop.For example:-

int a[10];

for(int i=0;i<10;i++)

{

    cin>>a[i];

}

Taking input of a 1-D array.

For creating a 2-D array we use nested loops.

int a[row][column];

for(int i=0;i<row;i++)

{

    for(int j=0;j<column;j++)

    {

          cin>>a[i][j];

    }

}

Hence the answer for this question is nested loops.

7 0
3 years ago
A device that modulates digital data onto an analog signal and then demodulates the analog signal back to digital data is a ____
LenKa [72]
A modem. (From modulator-demodulator)
5 0
3 years ago
In cell h13, insert a pmt function to calculate the payments for students who want to pay for their trips in three installments.
jolli1 [7]
All you need to do is use excell.
4 0
3 years ago
The GNU/Linux operating system comes with many built-in utilities for getting real work done. For example, imagine you had to an
natali 33 [55]

Answer:

Detailed solution is given below:

3 0
3 years ago
What is meant by editing a document​
Doss [256]

Answer: “Editing” in general means fixing problems in a written document so that it has no mistakes and is easy to read

Explanation: Yeah

5 0
3 years ago
Read 2 more answers
Other questions:
  • Crowdsourcing is:
    5·1 answer
  • Eye injuries usually occur as a result of all of the following things, EXCEPT:
    13·2 answers
  • Create a class called Hangman. In this class, Create the following private variables: char word[40], progress[40], int word_leng
    11·1 answer
  • Consider a Rational class designed to represent rational numbers as a pair of ints, along with methods reduce (to reduce the rat
    10·1 answer
  • What can help narrow your search results when using the Index search feature in the Help menu?
    7·1 answer
  • Is brainly bugging out rn? <br> The site isnt like loading completely
    5·1 answer
  • In what situation is a read receipt notification not sent when an email is opened or previewed bya recipient?
    8·2 answers
  • Who is responsible for developing the physical background for the characters by creating buildings, landscapes, and interiors?
    14·1 answer
  • If a student ate 3/4 (three-fourths) of their meals away from home, what % of the total day is spent eating other than at home?
    11·1 answer
  • The SQL SELECT built-in function COUNT ____.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!