Factors - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Factors

Hi again...Hope someone can help with the coding for the highest number below 1000 which has the most fcators (then print it). Need to get it done for tomorrow afternoon. Thats all the program has to do and not include 1 and the number itself. Bit of a beginner and have struggled for weeks on it.

Thanx

Anton

P.s...the code i have done is on a previous message from yesterday

Comments

  • stephlstephl Posts: 422Member
    : Hi again...Hope someone can help with the coding for the highest number below 1000 which has the most fcators (then print it). Need to get it done for tomorrow afternoon. Thats all the program has to do and not include 1 and the number itself. Bit of a beginner and have struggled for weeks on it.
    :
    : Thanx
    :
    : Anton
    :
    : P.s...the code i have done is on a previous message from yesterday
    :
    Try this.
    [code]#include


    int main(void)
    {
    int x,y,count=0,i,n;

    for (x=2;x<1000;++x)
    {
    i=0;
    for (y=2;y<1000;++y)
    if (!(x%y)) ++i;
    if (i>count) {n=x;count=i;}
    }
    printf("%d
    ",n);
    return 0;
    }[/code]
    Steph
  • anton19822anton19822 Posts: 12Member
    Thanks steph.

    That should be a big help.


Sign In or Register to comment.