Close

Results 1 to 2 of 2

Thread: newbie here

  1. #1
    DF PlaYa bean_2k1's Avatar
    Join Date
    Jan 2001
    Location
    Walsall
    Posts
    901
    Thanks
    0
    Thanked:        0
    Karma Level
    313

    Default newbie here

    Right i just start a BTECH course at collage and im doing c++ programming and im a bit stuck on this one

    // Program using a For loop

    # include <iostream.h>

    void main ()

    {

    int count,num,total;

    total=0;

    for (count=1; count<11; count++)

    {
    cout<<"Enter A Number\n";
    cin>>num;
    total=total + num;

    }

    cout<<"The Total is "<<total<<"\n";

    }

    Right after i put numbers in i need to be able to work out the average after i put all ten in now sure how to do that

    could any one help me please

  2. #2
    DF Jedi RhinoBanga's Avatar
    Join Date
    Nov 2000
    Location
    127.0.0.1
    Posts
    1,776
    Thanks
    20
    Thanked:        13
    Karma Level
    351

    Default

    Try:

    cout << "The total is " << total << "\n";
    cout << "The average is " << (total / 10) << "\n";

Similar Threads

  1. im a newbie and i need IE7 help!!
    By dave924 in forum Hall Of Shame
    Replies: 12
    Last Post: 18th August 2007, 05:57 PM
  2. newbie
    By bigtempy in forum Introduce Yourself (New Members)
    Replies: 2
    Last Post: 24th June 2007, 03:09 PM
  3. newbie
    By jason2307 in forum Introduce Yourself (New Members)
    Replies: 1
    Last Post: 18th June 2007, 10:51 PM
  4. Newbie
    By WappyNappy in forum Introduce Yourself (New Members)
    Replies: 2
    Last Post: 14th June 2007, 01:47 AM
  5. newbie
    By robroy_2000 in forum Introduce Yourself (New Members)
    Replies: 3
    Last Post: 10th May 2007, 12:09 AM

Social Networking Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •