Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

factors again

Hey thanks for your help.

I used your idea but i am a bit of a beginner at this C programming i have made changes in the code below but can't get it working.

Have i got the right idea...really struggling!!

Thanx again

Ant

#include
#include
long int y=1;
int max_fac = 0, x, factors;

main ()


{
for (x = 1; x <= 1000; x++) {
factors = 1;
for (y = 2; y <= x; y++)
if(x%y==0)



printf("%d, ", y);

if (factors > max_fac)


printf("%d
", x);

return 0;
}
}
Sign In or Register to comment.