Advertisement
Josif_tepe

Untitled

Nov 18th, 2021
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.51 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main() {
  5.    int a,b,i,pom,cifra,zbir,j,brdelitel;
  6.    printf("vnesi obsek od do\n");
  7.    scanf("%d%d",&a, &b);
  8.    for ( i=a; i<=b ; i++) {
  9.        pom=i;
  10.        zbir=0;
  11.        brdelitel=0;
  12.        while (pom!=0){
  13.            cifra=pom%10;
  14.            pom/=10;
  15.            zbir+=cifra;
  16.        }
  17.        for (j=1;  j<=zbir ; j++) {
  18.            if (zbir%j==0)
  19.                brdelitel++;
  20.        }
  21.        if (brdelitel==2)
  22.            printf("brojot e %d",i);
  23.    }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement