0
I have a problem with this code at the time of running. help me please.
using System; class ProjectEuler3{ public static void Main(){ long limit = 600851475143; int mf = 0; for (int p=1;p<10;p++){ if(limit%p==0){ mf = p; } else{continue;} } Console.WriteLine(mf); } } tells me that you are trying to divide by 0, what should I do?
7 Réponses
+ 1
Thank you so much.
+ 1
No problem 👌
And good luck! 👍
0
Are you sure you initialized <p> in the loop by 1? division by zero error shouldn't be raised unless <p> was initialized by zero.
0
yes, the value of "p" is inside the loop, and I need to enter a value of 12 digits but I can not use "int" I have to use "long" but I do not know how, how would you implement it?
0
Can you describe the program please? I'm not understanding what you are trying to do here ...
0
I need to find the largest prime factor of 600851475143.
0
I hope this helps you somehow
https://www.quora.com/How-do-I-find-the-largest-prime-factor-of-a-number