Close

Results 1 to 2 of 2

Thread: newbie here

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

    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 VIP Member
    RhinoBanga's Avatar
    Join Date
    Nov 2000
    Location
    127.0.0.1
    Posts
    1,780
    Thanks
    20
    Thanked:        13
    Karma Level
    389

    Default

    Try:

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

Similar Threads

  1. newbie
    By cadfile in forum Introduce Yourself (New Members)
    Replies: 1
    Last Post: 27th July 2006, 02:54 PM
  2. newbie......
    By matthewburton79 in forum Introduce Yourself (New Members)
    Replies: 6
    Last Post: 26th July 2006, 12:24 AM
  3. Hi a newbie again
    By netstaruk in forum Introduce Yourself (New Members)
    Replies: 4
    Last Post: 24th July 2006, 10:02 AM
  4. newbie
    By mem in forum Introduce Yourself (New Members)
    Replies: 3
    Last Post: 23rd July 2006, 02:30 PM

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
  •