Thread: Help !!! need to write program asap

  1. #1
    Registered User
    Join Date
    Nov 2006
    Posts
    1

    Help !!! need to write program asap

    hi all, im a complete newbie at this programming stuff, i am a 1st year student studying systems engineering and i need to write a program for my programming module, to calculate the mean, standard deviation and error in the mean of a set of numbers, can anyone point me in the write direction i have no idea how to do this

    please help !!!

    thanks

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Well you could start with a program which reads in a list of numbers from the user, then prints those numbers back out (just to make sure you read them OK).

    Then add something to count how many numbers were input.

    Then add the code to perform those calculations.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Eager young mind
    Join Date
    Jun 2006
    Posts
    342
    may be you can try this for mean , I have forgotten how do derive the SD for a given set of numbers.



    Code:
    int main()
    {    
        int i=0,N=0;
        float A[50],sum=0;
        printf(" enter the number of terms \n");
        scanf("%d",&N);
    
        for(i=0;i<N;i++)
            scanf("%f",&A[i]);
         
    
        for(i=0;i<N;i++)
           sum+=A[i];
    
        mean = sum/ N;
     
        printf( " mean = %f \n",mean);
    
     return 0;
    }
    write the other two in the same manner. Dont ask for code again.
    In the middle of difficulty, lies opportunity

  4. #4
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Quote Originally Posted by Adamakl
    hi all, im a complete newbie at this programming stuff, i am a 1st year student studying systems engineering and i need to write a program for my programming module, to calculate the mean, standard deviation and error in the mean of a set of numbers, can anyone point me in the write direction i have no idea how to do this

    please help !!!

    thanks
    Luckily, the right direction, is also the write direction. You need to begin by just writing out the step-by-simple step way that could be used to solve each of these calculations. Really do it like the computer is a complete idiot, with some uncanny numerical abilities.

    That's your algorithm. Now just turn your algorithm, into code, step by step, keeping each function separate from the other - so function names like GetMean, StdDev, and StdError should be front and center, perhaps.

    Look at the syntax for C in the programs in the FAQ, (and whatever books you may have on the subject), and when you get stuck, post up your code, and describe your problem, here.

    Lots of people here to help you along. You just need to show your effort and be specific about the problem you're having. When you post up your code, use code tags around it - so it looks like code.

    Adak

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 11:17 PM
  2. How to write a recursion program of this..
    By chillwater in forum C Programming
    Replies: 13
    Last Post: 08-09-2005, 04:52 AM
  3. Can I write & read file in same program?
    By chad03 in forum C Programming
    Replies: 2
    Last Post: 08-04-2003, 08:39 AM
  4. Challenge to write a program
    By Twisted.alice in forum A Brief History of Cprogramming.com
    Replies: 40
    Last Post: 05-15-2003, 12:00 PM
  5. fopen();
    By GanglyLamb in forum C Programming
    Replies: 8
    Last Post: 11-03-2002, 12:39 PM