Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Project Euler Problem 3 Solution
- #include <stdio.h>
- #include <stdlib.h>
- void lpf(long long int x)
- {
- long long int lpf = 2;
- while (x > lpf)
- {
- if (x%lpf==0)
- {
- x = x/lpf;
- lpf = 2;
- }
- else
- {
- lpf++;
- }
- }
- printf("Largest Prime Factor: %lld\n",lpf);
- }
- int main ()
- {
- long long int x;
- printf("Input long int:\n");
- scanf("%lld",&x);
- lpf(x);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement