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
A car is cruising at a steady speed of 35 mph. Suddenly, a cuddly puppy runs out into the road. The driver takes 1.7 seconds to
Schach [20]

Answer:

The distance traveled is 0.037 mi

Explanation:

The equation for the position and velocity of an accelerated object is:

x = x0 + v0 * t + 1/2 * a * t²

v = v0 + a * t

where

x = position at time t

x0 = initial position

t = time

a = acceleration

v0 = initial velocity

If the velocity is constant, then a = 0 and the position will be:

x = x0 + v * t where "v" is the velocity

First, let´s find the distance traveled until the driver push the brake:

The speed is constant. Then:

x = x0 + v * t (considering the origin of the reference system to be located at the point at which the driver sees the puppy, x0 = 0)

x = 35 mi/h (1 h / 3600 s) * 1.7 s = 0.017 mi

Then, the drivers moves with constant acceleration until the car stops (v = 0)

From the equation for velocity:

v = v0 + a * t

Since v = 0, we can obtain the acceleration of the car until it stops. With that acceleration, we can calculate how much distance the car moves before it stops.

0 = v0 + a * t

-v0 / t = a

-35 mi/h (1 h / 3600s) / 4.0 s = a

a = -2.4 x 10⁻³ mi/s²

The distance traveled will be:

x = x0 + v0 * t + 1/2 * a * t²

Now x0 will be the distance traveled before the driver slows down.

x = 0.017 mi + 35 mi/h (1 h / 3600s) * 4 s + 1/2 * ( -2.4 x 10⁻³ mi/s²) * (4s)²

x = 0.037 mi

6 0
3 years ago
A projectile fired from a gun has initial horizontal and vertical components of velocity equal to 30 m/s and 40 m/s, respectivel
faust18 [17]

Answer:

The time is 5.10 sec.

Explanation:

Given that,

Component of velocity are 30 m/s and 40 m/s.

We need to calculate the resultant velocity

Using formula of resultant velocity

v=\sqrt{v_{x}^2+v_{y}^2}

Put the value into the formula

v=\sqrt{(30)^2+(40)^2}

v=50\ m/s[

We need to calculate the time

Using equation of motion

v = u+gt

v = 0+gt

t=\dfrac{v}{g}

Put the value into the formula

t=\dfrac{50}{9.8}

t=5.10\ sec

Hence, The time is 5.10 sec.

7 0
3 years ago
K-2/5=11k literal equations
krek1111 [17]
-2/5 = 11k - k
-2/5 = 10k
-2/5/10 = k
-2/5 * 10 = k
-2/50 = k
k = -1/25.

-1/25 - 2/5 = 11k is true.
6 0
3 years ago
A 3250 N car is pushed a distance of 35 m the power was 11375 J, how long did it take?
irakobra [83]

Answer:

10.8s

Explanation:

Given parameters:

Force on the car  = 3250N

Distance  = 35m

Power  = 11375W

Unknown:

Time taken = ?

Solution:

To solve this problem;

 Power is the rate at which work is done

         Power = \frac{work done }{time}  

  Work done  = force x distance  = 3250 x 35  = 123200J

Now;

          11375  = \frac{123200}{t}  

           11375t  = 123200  

                   t  = 10.8s

5 0
3 years ago
What evidence supports the conclusion that a chemical reaction has occurred?
GalinKa [24]

Answer:

Precipitation formed

Temperature change

fizzing and hissing

bubbles

change in state

Explanation:

3 0
2 years ago
Other questions:
  • A man is riding his 4-wheeler at 60 km/hr. If he is riding it constantly at this rate for 1.5 hours, how far did he ride?
    10·1 answer
  • A tortoise travels 15 meters (m) west, then another 13 centimeters (cm) west. How many meters total has she walked?
    7·1 answer
  • A gas sample is heated from -20.0°C to 57.0°C and the volume is increased from 2.00 L to 4.50 L. If the initial pressure is 0.14
    8·1 answer
  • A cue ball of mass m1 = 0.325 kg is shot at another billiard ball, with mass m2 = 0.59 kg, which is at rest. The cue ball has an
    12·2 answers
  • Pure water has a pH of 7. Pure water _______. A. is a neutral substance B. could be either an acid or a base C. is a base D. is
    7·2 answers
  • Eating pizza with friends after a football game is most likey an example of which food choice factors?
    6·2 answers
  • Where are fossil fuels found?
    8·2 answers
  • Explain how the perfume atomizer works under Bernoulli's principle
    15·1 answer
  • Common sports injury : ankle sprain , bone fracture , muscle strain , neck low back pain , shoulder pain. First aid needed
    11·1 answer
  • hai điện tích điểm bằng nhau có độ lớn 6.10^-8C đặt cách nhau một khoảng là r trong dầu hỏa có hằng số điện môi E=2,1. Lực tương
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!