fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main (){
  5.  
  6. int x=1;
  7. int y=1;
  8. int c=0;
  9. int result;
  10. while ( c <10) {
  11.  
  12. result=((2*x)-(3*y));
  13. if (result < 5)
  14. x++;
  15.  
  16. else if (result > 5)
  17. y++;
  18.  
  19. else if (result==5) {
  20. cout << "X=" << x << "," << " Y=" << y << "." << endl;
  21. x++;
  22. y++;
  23. c++;
  24. }
  25. }
  26.  
  27. return 0; }
Success #stdin #stdout 0s 3140KB
stdin
Standard input is empty
stdout
X=4, Y=1.
X=7, Y=3.
X=10, Y=5.
X=13, Y=7.
X=16, Y=9.
X=19, Y=11.
X=22, Y=13.
X=25, Y=15.
X=28, Y=17.
X=31, Y=19.