Thread: function to determine factors of a number

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    34

    function to determine factors of a number

    hello all,
    I was wondering if there is a function that i can call that will get all of the factors of a number, or do i have to make one myself. I started to write one, but i didnt get very far. Any suggestions or comments would be helpful , thnaks guys
    dana

  2. #2
    Green Member Cshot's Avatar
    Join Date
    Jun 2002
    Posts
    892
    You have to write one yourself. A naive approach is to scan through every number from 1 to N and use % to test for factors of N.
    Try not.
    Do or do not.
    There is no try.

    - Master Yoda

  3. #3
    still a n00b Jaguar's Avatar
    Join Date
    Jun 2002
    Posts
    187

    Re: function to determine factors of a number

    Originally posted by lakai02
    a function that i can call that will get all of the factors of a number
    I used to write one but I displayed the result on stdout. Or you want the result in an array???
    slackware 10.0; kernel 2.6.7
    gcc 3.4.0; glibc 2.3.2; vim editor
    migrating to freebsd 5.4

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Issue w/ Guess My Number Program
    By mkylman in forum C++ Programming
    Replies: 5
    Last Post: 08-23-2007, 01:31 AM
  2. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  3. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 10:18 AM
  4. help with a source code..
    By venom424 in forum C++ Programming
    Replies: 8
    Last Post: 05-21-2004, 12:42 PM
  5. Creating a student grade book-how?
    By Hopelessly confused in forum C Programming
    Replies: 5
    Last Post: 10-03-2002, 08:43 PM