Jump to content


Photo

Math Averages


  • Please log in to reply
4 replies to this topic

#1 mathnewbie

mathnewbie

    GMC Member

  • New Member
  • 3 posts
  • Version:Unknown

Posted 19 April 2012 - 10:38 PM

Hi, how would you make a system that would calculate an average. Example, lets say I have 3 number (10-5-20) now how would I make an object that you could click on that would give you the average of the 3 numbers? trying to make a simple math program to calculate averages. Any ideas? thanks!
  • 0

#2 ookami125

ookami125

    GMC Member

  • GMC Member
  • 217 posts
  • Version:GM:Studio

Posted 19 April 2012 - 10:59 PM

would you like to add any amount of numbers or just 3 every time?

if you'd like to use any amount of numbers this would most likely work best:
//argument0=Number of values you are using
//put all values into array "value[x]"
var i, result;
while(i<argument0)
{
result=value[i];
i+=1;
}
return result/argument0;

Edited by ookami125, 19 April 2012 - 11:03 PM.

  • 0

#3 mathnewbie

mathnewbie

    GMC Member

  • New Member
  • 3 posts
  • Version:Unknown

Posted 19 April 2012 - 11:49 PM

Hi, how would you make a system that would calculate an average. Example, lets say I have 3 number (10-5-20) now how would I make an object that you could click on that would give you the average of the 3 numbers? trying to make a simple math program to calculate averages. Any ideas? thanks!


Hi, only three numbers. Also how would you design this? Do you chaege a fee to help desing a demo? Thank you.
  • 0

#4 thegame

thegame

    Flying Penguin

  • GMC Member
  • 1411 posts
  • Version:GM:Studio

Posted 20 April 2012 - 12:35 AM

I do believe that GM has a 'mean' function which calculates the mean (average) of whatever numbers you give it (up to 16 values). I'm not sure if they put it in HTML5 yet, but they probably did...
  • 0

#5 mathnewbie

mathnewbie

    GMC Member

  • New Member
  • 3 posts
  • Version:Unknown

Posted 28 April 2012 - 11:19 PM

would you like to add any amount of numbers or just 3 every time?

if you'd like to use any amount of numbers this would most likely work best:

//argument0=Number of values you are using
//put all values into array "value[x]"
var i, result;
while(i<argument0)
{
result=value[i];
i+=1;
}
return result/argument0;


Can I hire anyone to help me make this?
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users