Thread: Quick Help Please

  1. #1
    Registered User
    Join Date
    Mar 2003

    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
    try it, post your code, then we will be glad to help you.

  3. #3
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    - 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.


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