Quick Help Please

This is a discussion on Quick Help Please within the C++ Programming forums, part of the General Programming Boards category; I'm not sure on how to do this program Please send your helpful results as soon as possible. I use ...

  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    6

    Exclamation Quick Help Please



    I'm not sure on how to do this program Please send your helpful results as soon as possible. I use DEV C++.

    I need to write a program that will calculate the sum of even numbers between limits entered by the user. For example, if the user entered 4 and 10, the program would calculate 4+6+8+10 and print 28 as the answer. Note that the two numbers can be entered in any order and may be odd or even. Entering 11 and 3 would also result in an answer of 28.

    Thank you 4 your help and response in advance.

  2. #2
    Registered User
    Join Date
    Nov 2002
    Posts
    1,109
    try it, post your code, then we will be glad to help you.

  3. #3
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,659
    Code:
    - input 2 numbers, a, b
    - order numbers so a < b
    - find first even # starting at 'a' and store in 't'
    - use for loop from 't' to 'b', incrementing by 2 and sum the numbers in 's'
    - use % to determine if a number is even.

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Do you know...
    By davejigsaw in forum C++ Programming
    Replies: 1
    Last Post: 05-10-2005, 10:33 AM
  2. recursive quick sort - stack overflow
    By Micko in forum C Programming
    Replies: 9
    Last Post: 01-01-2005, 04:51 PM
  3. Questions on basic Quick Sort
    By Weng in forum C++ Programming
    Replies: 4
    Last Post: 12-16-2003, 09:06 AM
  4. Quick Sort Help
    By NavyBlue in forum C Programming
    Replies: 1
    Last Post: 03-02-2003, 09:34 PM
  5. Replies: 0
    Last Post: 04-30-2002, 07:24 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21