Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int cmdiv(int x, int y)
- {
- while(x!=y)
- if(x>y)
- x=x-y;
- else
- y=y-x;
- return x;
- }
- int main()
- {
- int poz=0, v[100], a,b,n;
- cin>>a;
- cin>>b;
- cin>>n;
- if(a>b)
- {
- int aux=a;
- a=b;
- b=aux;
- }
- for (int i=a; i<=b; i++)
- if(!(cmdiv(i, n)>1))
- {
- v[poz]=i;
- poz++;
- }
- for(int i=0; i<poz; i++)
- cout<<v[i]<<" ";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement