Advertisement
Josif_tepe

Untitled

Nov 12th, 2023
666
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.68 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <ctype.h>
  5. #include <math.h>
  6.  
  7. int main(int argc, char * argv[]) {
  8.     int a, b;
  9.     scanf("%d%d", &a, &b);
  10.    
  11.     for(int i = a; i <= b; i++) {
  12.         int tmp = i;
  13.         int prevrten = 0;
  14.        
  15.         while(tmp > 0) {
  16.             int cifra = tmp % 10;
  17.             prevrten = (prevrten * 10) + cifra;
  18.             tmp /= 10;
  19.         }
  20.         int deliteli = 0;
  21.         for(int j = 1; j <= prevrten; j++) {
  22.             if(prevrten % j == 0) {
  23.                 deliteli++;
  24.             }
  25.         }
  26.         if(deliteli <= 2) {
  27.             printf("%d ", i);
  28.         }
  29.     }
  30.    
  31.     return 0;
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement