Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main() {
- unsigned n,x,eprim,dif,d,difepr;
- do {
- cout<<"nr sa fie par:"<<endl;
- cout<<"n=";cin>>n;
- }while (n%2!=0);
- for (x=3;x<=n/2;x+=2)
- {
- eprim=1;d=2;
- while (d<=sqrt(x))
- {
- if (x%d==0)
- eprim=0;
- d++;
- }
- if (eprim)
- {
- dif=n-x;
- difepr=1;
- for (d=2;d<=dif/2;d++)
- if (dif%d==0)
- difepr=0;
- if (difepr) {
- cout<<"nr poate fi scris ca "<<x<<'+'<<dif<<endl;
- //break;
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement