Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- int n, i, j, max, suma, poz;
- scanf("%d", &n);
- max = 0;
- poz = 2;
- for(i = 2; i <= n; i++)
- {
- suma = 0;
- for(j = 2; j <= i / 2; j++)
- {
- if(i % j == 0)
- {
- suma += j;
- }
- }
- if(suma > max)
- {
- max = suma;
- poz = i;
- }
- }
- printf("%d\n", poz);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment