Advertisement
Josif_tepe

Untitled

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