Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h> //??? Swap() doesn; change values in main! Fix it!!! Call by //reference and so on
- //plus – I want to print every 3 unique combinations just once, not 6 times!
- #define SIZE 50
- void swap_abc(int,int,int);
- int main()
- {
- int a,b,c,arr[SIZE][SIZE];
- for(a=1;a<SIZE;a++)
- {
- for(b=1;b<SIZE;b++)
- {
- for(c=1;c<SIZE;c++)
- {
- if((a*a==b*b+c*c)||(c*c==a*a+b*b)||(b*b==a*a+c*c))
- {
- printf("%d %d %d\t",a,b,c);
- swap_abc(a,b,c);
- printf("%d %d %d\n",a,b,c);
- }
- }
- }
- }
- return 0;
- }
- void swap_abc(int aa,int bb,int cc)
- {
- int temp;
- while((aa>bb)||(bb>cc)||(aa>cc))
- {
- if(aa>bb)
- {
- temp=aa;aa=bb;bb=temp;
- }
- if(bb>cc)
- {
- temp=bb;bb=cc;cc=temp;
- }
- if(aa>cc)
- {
- temp=aa;aa=cc;cc=temp;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement