ivana_andreevska

3

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