Any c# programmers here? I'm ripping my damn hair out over this stupid math equation for my c# program

any c# programmers here? I'm ripping my damn hair out over this stupid math equation for my c# program.

yes

no

Same

//The spacecraft will accelerate from 0 MPD (Miles Per Day) at launch to 1000 MPD by the end of the first day, and will have covered 500 miles (average speed of (0 + 1000)/2= 500). At the end of day two, it will be up to 2000 MPD (double day one's speed), and will have covered 2000 miles total (the previous day’s 500 miles plus the new day’s average of (1000+2000)/2)).

-- I have the doubling sequence figured out, but I'm having trouble with the addition of the average speed.

///
for (counter = 1; counter

Never-mind, figured it out.

I can't figure out how to calculate the average speed, and then store it to use for math for the next day

nvm figured it out again

I'm on my phone

Int avg = (oldspeed+newspeed)/2

>I can't figure out how to calculate the average speed
but the formula is given to you

>and then store it to use for math for the next day
declare more variables duh

I should put that to an accumulator to use for the old speed variable for future loops, right?

Sure, but could also do something like

Avg = (speed + (speed *= 2))/2

Idk, maybe won't compile, it's late here

install gentoo

distance is separate than speed

dst = 0
oldSpeed = 0
newSpeed = 1000
for (i=1 i

forgot the + in dst calculation

Thank you very much, it works perfectly.
I spent an embarrassingly long time trying to figure it out, lol.

no prob. understand the problem and use pseudocode first before sitting at the computer to code.

it becomes easier once you declare the right variables in the right places.

This is fucking math problem, not programing problem.
And if you are using loops for it, you are fucking retarded.

Did you take physics in highschool? This should be trivial.

sorry, not everyone is a math genius like you

>genius
>for stuff you learn in elementary school

>any c# programmers here
>posts generic preschool math problem
turbonigger

What's the best book to get started on see sharp? I've only played around in python before.

>book
Just google a C# tutorial

haha exactly my thoughts but as soon as i've read c# i already knew this was going to be some kiddy

>MPD
what a shitty scale

>C# "programmer"
Yeah just like HTML programmers

Use the code tags you cock throbbling faggot

this