Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- int main()
- {
- int n, x, r, a, b, rez=1;
- cin >> n;
- for (int i = 1; i <= n; i++)
- {
- cin >> x;
- a = n;
- b = x;
- r = a%b;
- while (r!=0)
- {
- a = b;
- b = r;
- r = a%b;
- }
- if (b==1)
- rez = rez*x;
- }
- cout << rez;
- return 0;
- }
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- int main()
- {
- int n, p=2, x, y, c=1;
- cin >> n; //1
- cin >> x; //5
- cin >> y; //10
- while(c <= n)
- {
- p = p * 2; //4
- if(p>=x)
- {
- if (p <= y)
- {
- cout << p << endl;
- c++;
- }
- }
- }
- return 0;
- }
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- int main()
- {
- int n, x, y,p=0,ctr=0
- cin >> n
- for(int i=1; i<=n; i++)
- {
- cin>>x;
- y=x%10;
- p=p*10+y;
- }
- for(int k=2; k<=p/2; k++)
- {
- if(p%k==0)
- ctr++;
- }
- if(ctr)
- cout<<"Numarul "<<p<<" Nu este prim"<<endl;
- else
- cout<<"Numarul "<<p<<" Este prim"<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement