Advertisement
STANAANDREY

6_12_2018

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