Advertisement
a53

Triplete

a53
Jan 6th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. void triplete(int a,int b,int c)
  2. {
  3. int ok=0,x,y,z;
  4. for(x=a;x<=b&&x<=c/3;++x)
  5. for(y=x;y<=b&&x+2*y<=c;++y)
  6. {
  7. z=c-x-y;
  8. if(z>=y&&z<=b)
  9. {
  10. ok=1;
  11. cout<<"{"<<x<<","<<y<<","<<z<<"}\n";
  12.  
  13. }
  14.  
  15. }
  16. if(ok==0)
  17. cout<<"nu exista";
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement