Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //TRÓJKA PITAGOREJSKA
- #include <iostream>
- using namespace std;
- int euklides(int a, int b)
- {
- if(b == 0) return a;
- else return euklides(b, a % b) ;
- }
- int main(){
- int c;
- cin>>c;
- for(int n=1;n<c;n++)
- for(int m=n+1;m*m+n*m<c;m++)
- if((m+n)%2 && euklides (m,n)==1)
- cout<<m*m-n*m<<" "<<2*m*n<<" "<<m*m+n*n<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment