Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- int n,suma=0,max=0,temp=0;
- scanf("%d",&n);
- for(int j=1;j<n;j++) // pocvime od 1 i inkrementirame se do toj broj
- {
- suma=0;
- for(int i=1;i<j;i++) // pocvime od 1 i odime do j odnosmo primer ako j e 6 provervime do 5 za j
- {
- if(j%i==0)
- {
- suma+=i;
- }
- //printf("Brojot %d ima suma %d \n",i,suma);
- if(suma>max)
- {
- temp=j;
- max=suma;
- }
- }
- }
- printf("%d",temp);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment