## programing

Hi ,

pls i need your help .
i write algorithm that calculate prefix average

..

sum=0
for i=1:n do
sum =suma+a
b=sum/i
return array b

my teacher said , write above code using insted for ..
how i can use the other for ..

## Fbody 682

I'm afraid we're going to need more information. It's not real clear what you're trying to accomplish.

A nested for loop is nothing more than a for loop inside another statement block of some sort, such as another for loop.

``````for (int i = 0; i < limitingValue1; ++i) { //outer loop
//statements here
for (int j = 0; j < someOtherLimit; ++j) {  //inner / nested loop
//statements here
}
//statements here
}``````

## programing

yes , I know its a simple thing , i write like you but i lost .
which statement should be first ,and which should be in inner statement and outer statement

...

## Fbody 682

Your algorithm is pretty simple, but your intent isn't clear. We really can't give you any direction unless you share your assignment's goals and/or make your intentions clearer. I would advise you to post the code you have written to this point as well. Without that code and more information about what specifically you are trying to accomplish all we can do is make wild guesses.

If you have more than one index that you need to modify/track, and they need to move somewhat independently of each other, each index should be managed by its own loop. That's really all I can tell you.

## programing

yes , the content of link is very clear for me ..

thank you so much my dear .

## programing

sory , i edit my Thread

because i dont know how i can explain for you .
and i didnt see that link you put .
when i see iam understand how i can solve my problem thanks

.. if you have other links that explain algorithm ..pls put here

## Fbody 682

yes , the content of link is very clear for me ..

thank you so much my dear .

That's not my file. It's one that Google turned up.

## JAGS 521

Hi, I am new to using C++ and i have to write a program that asks the user how many test scores they have, and then reads the test scores, averages them, and displays the average and a pass/fail grade appropriate for that average (such as, "passing is 50 or higher, failing is below 50"). use a separate function to average the input values.
I would appreciate any help thanks

## Fbody 682

Hi, I am new to using C++ and i have to write a program that asks the user how many test scores they have, and then reads the test scores, averages them, and displays the average and a pass/fail grade appropriate for that average (such as, "passing is 50 or higher, failing is below 50"). use a separate function to average the input values.
I would appreciate any help thanks

That is a ridiculously easy program. I suggest: