Help with a C++ program

Discussion in 'Windows Desktop Systems' started by Cookiexide, Jan 15, 2003.

  1. Cookiexide

    Cookiexide Guest

    Hey guys I need help with writing a program. I need to make a program that finds the integer from 1 to 1000 with the most divisors that produce no remainder. For example, the integer 60 has 12 divisors that produce no remainder.
    They are 1,2,3,4,5,6,10,12,15,20,30,60.
    Can anyone help? Thanks in advance!
     
  2. Sazar

    Sazar F@H - Is it in you? Staff Member Political User Folding Team

    Messages:
    14,905
    Location:
    Between Austin and Tampa
    since I don't have a compiler on my system right now I will just try and give you the basics on what to do...

    I don't know the extent of your coding knowledge so I will try and keep it as simple as possible...

    first of my question would be do you have an input? or are you just compiling the proggy and once that is done it outputs the integers divisible with no remainder?

    I would loop the proggy to do a from i <= 1000 do divide number (n or whatever you want to call it)... within that loop have error checking as in verify result.. so that if there is a decimal the value is thrown out, if not value is stored either in array or is output...

    example of alogorithmic flow would be if val = certain criteria than cout (or store in array) else go to next i...

    I mean there are a few ways to do this...

    you are looking at a couple of loops and use of arrays seems to be a must to keep things nice and tidy...

    sorry I was not more help :) extremely sleepy right now... in process of waking up...
     
  3. Un4gIvEn1

    Un4gIvEn1 Moderator

    Messages:
    1,084
    Do you deal with Pocket PCs?

    If so, I am looking for a NEW Dell Axim X5 Advance (that's the one with the 400Mhz Processor). What kind of price can you offer on this?
     
  4. Sazar

    Sazar F@H - Is it in you? Staff Member Political User Folding Team

    Messages:
    14,905
    Location:
    Between Austin and Tampa
    I would recommend that you look @ the thread before you start posting...

    :)
     
  5. Zedric

    Zedric NTFS Guru Folding Team

    Messages:
    4,006
    Location:
    Sweden
    The number between 1 and 1000 that has the most divisors with no remainder? That's easy. :) It's 512 and 768.
    The smallest divisor is 2. A number built up only by 2:s must be the smallest number with a specific number of divisors. 2^9 = 512. 9 divisors.
    768 = 3*2^8. So that's also 9 divisors.
    10 divisors, 2^10 = 1024 which is just to big.

    No program needed. :)
     
  6. Sazar

    Sazar F@H - Is it in you? Staff Member Political User Folding Team

    Messages:
    14,905
    Location:
    Between Austin and Tampa
    lol... cardinal rule of programming... understanding the question before lurching into coding...

    heh cheers zed :) teach me to be awake when I post...

    :cool:
     
  7. Cookiexide

    Cookiexide Guest

    Thanks for your help guys. :D