Thread: a program on arrays. need some help.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    printf will substitute an expression for the format specifier in the " " part of the printf line of code.

    In this case, it will substitute sum/count for the %f. Obviously, sum is not staying zero the whole time, since 0/any number is nonsense.

    To find an average, you need two things: 1) The sum of the quantities you're averaging, and 2) The number of items that you are putting into the sum.

    If you play with that code a bit, you'll sort it out.
    Last edited by Adak; 10-15-2010 at 11:24 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Hi, Quiz C program Assignment updated
    By Eman in forum C Programming
    Replies: 19
    Last Post: 11-22-2009, 04:50 PM
  2. c program that accepts and executes commands?
    By Cimposter in forum C Programming
    Replies: 3
    Last Post: 09-30-2009, 02:58 PM
  3. Need help with my program...
    By Noah in forum C Programming
    Replies: 2
    Last Post: 03-11-2006, 07:49 PM
  4. Replies: 0
    Last Post: 10-29-2001, 11:40 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM