i have been asked to write a program that will get a series (unlimited) of real and positive numbers from the user. for every number in the series, the program will print the average of that number with his neighbors, so that we get a new series if numbers (the averages). if the user put a negative number, the program will stop working.

if the program gets the series: a1, a2, a3, a4

it shoul print: (a1+a2)/2, (a1+a2+a3)/3, (a2+a3+a4)/3, (a3+a4)/2

can someone help me with that?

if the program gets the series: a1, a2, a3, a4

it shoul print: (a1+a2)/2, (a1+a2+a3)/3, (a2+a3+a4)/3, (a3+a4)/2

can someone help me with that?

So your problem is with a loop doing the averages?

Can you be specific with your problem, and give a sample of your code your have so far.

Can you be specific with your problem, and give a sample of your code your have so far.

Last edited on

Topic archived. No new replies allowed.