Thread: Anyone here good with math?

  1. #1
    Un Artiste Extraordinaire volk's Avatar
    Join Date
    Dec 2002
    Posts
    357

    Question Anyone here good with math?

    I didn't take statistics yet, but, anyway, how would you calculate the standard deviation of 10, 33, and 50 using C language?

  2. #2
    Registered User Draco's Avatar
    Join Date
    Apr 2002
    Posts
    463
    all you have to do is use the same formula(s) as the math gives you. You probably don't need to do anything special. You should look in an encyclopedia, a library, or just on the internet for how to do a standard deviation. That isn't really a programming question anyway.

  3. #3
    Back after 2 years Panopticon's Avatar
    Join Date
    Dec 2002
    Posts
    262
    Code:
    int scores[100],amount; //null terminated, max 99 scores
    long int total=0;
    double average,answer;
    long double numerator=0;
    //input
    //...
    //assuming scores[] is still null terminated
    for(amount=0;scores[amount];amount++) total+=str[amount];
    //amount has number of scores
    average=total/amount;
    for(int i=0;scores[i];i++) numerator+=((scores[i]-average)*(scores[i]-average));
    answer=sqrt(numerator/average);
    Im pretty sure I got the equation for S.D right. You may want to verify.
    I AM WINNER!!!1!111oneoneomne

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Math
    By knightjp in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 04-01-2009, 05:36 PM
  2. Any good tutorials?
    By kimmag in forum C++ Programming
    Replies: 3
    Last Post: 12-02-2008, 07:44 AM
  3. What are some good books on C?
    By php111 in forum C Programming
    Replies: 9
    Last Post: 10-01-2008, 06:16 AM
  4. For the math junkies
    By confuted in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 09-14-2003, 05:09 PM
  5. linked list recursive function spaghetti
    By ... in forum C++ Programming
    Replies: 4
    Last Post: 09-02-2003, 02:53 PM