Advertisement
Josif_tepe

Untitled

Nov 15th, 2022
866
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.51 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(){
  5.     int N;
  6.     scanf("%d", &N);
  7.    
  8.     int najgolem_zbir_na_deliteli = 0, broj = 0;
  9.     for(int i = 1; i < N; i++) {
  10.         int zbir = 0;
  11.         for(int j = 1; j < i; j++) {
  12.             if(i % j == 0) {
  13.                 zbir += j;
  14.             }
  15.         }
  16.        
  17.         if(zbir > najgolem_zbir_na_deliteli) {
  18.             najgolem_zbir_na_deliteli = zbir;
  19.             broj = i;
  20.         }
  21.     }
  22.    
  23.     printf("%d\n", broj);
  24.     return 0;
  25.  
  26. }
  27.  
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement