Advertisement
Josif_tepe

Untitled

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