Advertisement
Josif_tepe

Untitled

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