Advertisement
STANAANDREY

p2

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