I'm new to Matlab, and completely stuck on this one. I'm supposed to generate a script that finds all combinations of the Pythagorean triples with integers <= 50. I got most of the way there, but I can't figure out out to get rid of the repeating numbers. Here's what I have.
n=1;
for a_ = 1:50
for b_ = 1:50 c_=sqrt(a_^2+b_^2); if c_==round(c_) if c_<=50 a(n)=a_; b(n)=b_; c(n)=c_; n=n+1; end end clear c_ endendPyth=[a',b',c'];disp(Pyth)
Best Answer