Eliminating jumping repetitions of different orders

I wrote a program for class. It did its job, but I want to make it better. The program finds all of the Pythagorean triples between 1 and 100.

As you can see, the program will repeat the same Pythagorean triples but in different orders.

What I want to do is have the program repeat each Pythagorean triple once, regardless of whether the ordering is different. I have tried, but only came up with the solution to solving repetition that is consecutive. But the repetition for Pythagorean triples jump around.

I got stuck on how to eliminate jumping repetitions. I only know how to make it not repeat on consecutive entries.

Can anyone give some advice? I think this knowledge might be helpful for future codes.

EDIT: Deleted code and some other stuff because problem solved.


Last edited on
> As you can see
no, I don't

> I nested one for loop, in another for loop that is nested in another for loop
post code
I was hesitant at first because I discovered that someone here goes to the same school as I do. I'll upload it anyway, no way around it I guess.
Last edited on
Change b=1 on line 23 to b = a+1
Change c=1 on line 26 to c = b+1
for(int b=a; b<=100; b++)
That works. I confused myself and thought it didn't work when changing the initial values because it didn't output (12, 5, 13). Then I realized that (12, 5, 13) is output as (5, 12, 13) already. I confused myself there. Thanks.





Last edited on
Topic archived. No new replies allowed.