Advertisement
Josif_tepe

Untitled

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