display of divisors

This is a discussion on display of divisors within the C++ Programming forums, part of the General Programming Boards category; hey all i gotta write a programs that works like this: --------------------------- Enter number: 12 Divisors: 1 2 3 4 ...

  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    28

    display of divisors

    hey all i gotta write a programs that works like this:
    ---------------------------
    Enter number: 12
    Divisors: 1 2 3 4 6
    ---12 is Abundant
    ---------------------------

    Can anybody tell me how to display the divisors in one line like that? i know how to do the rest btw; thanx

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    23,794
    Well, if you know how to do the rest, what have you done?
    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

  3. #3
    Registered User
    Join Date
    Oct 2008
    Posts
    28
    i know how to write the code but it only displays the first divisors which is 1, now i want it to display them all

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    23,794
    i know how to write the code but it only displays the first divisors which is 1, now i want it to display them all
    Clearly, you need to use at least one loop.
    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. Display Color dialog
    By Cherry65 in forum Windows Programming
    Replies: 4
    Last Post: 02-17-2009, 10:41 AM
  2. display character size...(quite urgent..)
    By karthi in forum C Programming
    Replies: 10
    Last Post: 07-11-2007, 09:42 PM
  3. new problem with class
    By jrb47 in forum C++ Programming
    Replies: 0
    Last Post: 12-01-2006, 07:39 AM
  4. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM
  5. Speeding Up Display Time in CEditView :: MFC
    By kuphryn in forum Windows Programming
    Replies: 0
    Last Post: 04-22-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