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
Keith_Richards [23]
3 years ago
9

Write a program that calculates the average of n integers. the program should prompt the user to enter the value for n and then

afterward must enter all n numbers. if the user enters a nonpositive value for n, then an exception should be thrown (and caught) with the message "n must be positive." if there is any exception as the user is entering the n numbers, an error message should be displayed, and the user prompted to enter the number again.
Physics
1 answer:
ikadub [295]3 years ago
8 0

#include<studio.h>

int main( )

{

int n;

int a,b,c,d,x,y;

int avarage;

printf("enter value of n:\n");

scanf("%d",&n);

printf("enter value of a:\n,b:\n,c:\n,d:\n,x:\n,y:\n);

scan f("%d\%d\n%d\n%d\n%d\n%d\n",&a,b,c,d,x,y);

sum=(a+b+c+d+x+y);

avarage=(sum/n);

print f("%d",avarage);

if

{

n=positive interger

}

else

{

printf ("n must be positive");

}

return 0;

}

You might be interested in
Rahul sits in a chair reading a book. Which force is equal to the force Rahul exerts on Earth?
CaHeK987 [17]
In fact, the force Rahul exerts on Earth corresponds to the force of gravity. But Rahul's weight is, in fact, the force of gravity exerted by the Earth on Rahul, and these two forces correspond to the action-reaction pair of Newton's third law, which states that the two forces are equal.
7 0
3 years ago
Read 2 more answers
Rebecca heated 50mL of water from 0 degrees Celsius to 60 degrees Celsius. How much energy did she use to heat the water? Rememb
kramer

Answer:

12552 J or 3000 calories

Explanation:

Q = m × c × ∆T

Where;

Q = amount of heat energy (J)

m = mass of water (g)

c = specific heat capacity (4.184 J/g°C)

∆T = change in temperature

For 50mL of water, there are 50g, hence, m = 50g, c = 4.184 J/g°C, initial temperature = 0°C, final temperature = 60°C.

Q = m × c × ∆T

Q = 50 × 4.184 × (60 - 0)

Q = 209.2 × 60

Q = 12552 J

Hence, the amount of heat energy used to heat the water is 12552 J or 3000 calories

3 0
3 years ago
Question 26 suppose that a constant force is applied to an object. newton's second law of motion states that the acceleration of
ololo11 [35]

<span>The answer is 6 kg the mass of the second object. By using Inversely proportional formula it means that (14 kg) (3 m/s</span>²<span>) = M (7 m/s</span>²<span>). Where M is the mass of the second object. For the Newton’s second law of motion formula which is: Force = mass x acceleration, we have:</span>

<span>F = (14 kg) (3 m/s</span>²<span>) = 42 N</span>

 

Therefore:

<span>42 N = M (7 m/s</span>²)

<span>M = (42 N) / (7 m/s</span>²<span>)</span>

M = 6 kg mass of the second object

4 0
3 years ago
A U-shaped valley is most often formed by
Elza [17]

formed by the process of glaciation.

5 0
3 years ago
Read 2 more answers
A red flag at the ocean signifies that swimmers are not allow in the water and that the the conditions are too ? True or False
Leto [7]

Answer:

true

Explanation:

3 0
3 years ago
Read 2 more answers
Other questions:
  • Can I have some help? I Really need it!
    5·2 answers
  • During a fission each time an atom divides ___.
    5·2 answers
  • A certain simple pendulum has a period on the earth of 2.00 s . part a what is its period on the surface of mars, where g=3.71m/
    10·1 answer
  • If you cook a marshmallow a few feet above a camp fire, it will cook mostly
    12·1 answer
  • The strength of an electromagnet can be altered by
    5·2 answers
  • A mass hanging from a spring undergoes vertical simple harmonic motion.1) Where in the motion is the velocity equal to zero?At t
    7·1 answer
  • What property makes ocean water a good conductor of electricity
    10·1 answer
  • A new concrete mix is being designed to provide adequate compressive strength for concrete blocks. The specification for a parti
    13·1 answer
  • What would happen to a balloon placed in the freezer?
    12·2 answers
  • The more diverse an ecosystem is —
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!