Created
November 6, 2018 03:49
-
-
Save tabvn/ac439aecd6e2c634aa68d8faecce9bd8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void displayCoupleOfNumber(int n){ | |
| int b = 0; | |
| int tmp = sqrt(n); | |
| int a = tmp; | |
| while(true){ | |
| if(a<=0 || b >= tmp){ | |
| break; | |
| } | |
| if(a*a + b*b < n){ | |
| cout << "(" << a << ", "<< b<< ")" << endl; | |
| cout << "(" << b << ", "<< a<< ")" << endl; | |
| b++; | |
| }else{ | |
| a--; | |
| b = 0; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment