Advertisement
Josif_tepe

Untitled

Jan 26th, 2025
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. int funkc(int x) {
  6.     if(x==0)
  7.     {
  8.         return 1;
  9.     }
  10.     int br=0;
  11.     int cifra=x%10;
  12.     for(int i=1;i<=cifra;i++) {
  13.         if (cifra%i==0) {
  14.             br++;
  15.         }
  16.        
  17.     }
  18.     if(br==2){
  19.         return funkc(x/10)*cifra;
  20.        
  21.        
  22.     }
  23.     else {
  24.         return funkc(x/10);
  25.     }
  26.    
  27. }
  28.  
  29.  
  30.  
  31. int main() {
  32. int x;
  33.   cin>>x;
  34. cout<<funkc(x)<<endl;
  35.  
  36.  
  37.   return 0;
  38. }
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement