Advertisement
Josif_tepe

Untitled

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