Advertisement
STANAANDREY

b2

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