Advertisement
STANAANDREY

c3

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