Skip to content

Instantly share code, notes, and snippets.

@matutter
Created April 3, 2014 15:32
Show Gist options
  • Save matutter/9956647 to your computer and use it in GitHub Desktop.
Save matutter/9956647 to your computer and use it in GitHub Desktop.
nested for loops and running average
for ( y = 0; y < rows ; y++)
{
for ( x = 0; x < cols ; x++)
{
number[y][x] = (rand() % 10001 + 5);
if(hi < number[y][x]) hi= number[y][x];
count++;
avg-=avg/(float)count;
avg+=number[y][x]/(float)count;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment