Finding odd numbers

This is a discussion on Finding odd numbers within the C++ Programming forums, part of the General Programming Boards category; I am trying to write a short and concise C++ program to find the following: 6 non repeating odd numbers ...

  1. #1
    Registered User
    Join Date
    Dec 2010
    Posts
    1

    Finding odd numbers

    I am trying to write a short and concise C++ program to find the following:
    6 non repeating odd numbers who's sum equals 60.
    The smallest odd number equals to 1.
    The largest odd number equals to 17.
    Please Help. I writing too many lines of code and I am told it can be done in simpler ways.
    Thank You.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    23,803
    What have you tried?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Extracting numbers from a string
    By Veneficvs in forum C++ Programming
    Replies: 6
    Last Post: 04-30-2010, 08:43 AM
  2. finding numbers in text files
    By ioanLesbi in forum C Programming
    Replies: 3
    Last Post: 04-04-2010, 11:51 PM
  3. Help C program that reads Odd numbers and evens
    By Cyberman86 in forum C Programming
    Replies: 4
    Last Post: 02-27-2009, 10:59 AM
  4. adding odd numbers only
    By CheyenneWay in forum C++ Programming
    Replies: 12
    Last Post: 05-06-2004, 12:22 AM
  5. adding odd numbers
    By Unregistered in forum C Programming
    Replies: 5
    Last Post: 09-06-2001, 01:44 PM

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