pythagoras integer sides triangle
Absolute beginner needs tips!!
I need to make a program that gives me triangles with only integer numbers using a2+b2=c2.
Here's my code, it works but it gives me double results as you can see. How can I improve, just using code I already now? (loop statements, conditions etc..)
Thanks for any tips
// Ex. 5.21 Pythagorian triples
public class Pythagorian
{
public static void main( String args[] )
{
int a = 0;
int b = 0;
int c = 0;
for( a = 1 ; a <= 9 ; a++ )
{
for( b = 1 ; b <= 9 ; b++ )
{
for ( c = 1 ; c <= 100 ; c ++)
if ((c*c)==(a*a + b*b))
System.out.printf( "A is %d and B is%d and C is %d\n" , a , b, c);
} // end b
} // end a
} // end main
} // end class

