A Pythagorean triple consists of three positive integers a, b, and c,
such that a2 + b2 = c2 . Such a triple is commonly written (a, b, c), and a well-known example is (3, 4, 5).
There are 16 primitive Pythagorean triples with c ≤ 100:
( 3, 4, 5) ( 5, 12, 13) ( 7, 24, 25) ( 8, 15, 17)
( 9, 40, 41) (11, 60, 61) (12, 35, 37) (13, 84, 85)
(16, 63, 65) (20, 21, 29) (28, 45, 53) (33, 56, 65)
(36, 77, 85) (39, 80, 89) (48, 55, 73) (65, 72, 97)
#include <iostream.h>
#include <conio.h>
void main()
{
int side1, side2, hyp;
cout<< " \n Pythagorean triples between 1 to 100 :\n\n ";
for( side1 = 1; side1< =100 ; side1 ++)
for( side2 = 1; side2< =100 ; side2 ++)
for( hyp = 1; hyp< =100 ; hyp ++)
if((side1*side1 + side2*side2) = = hyp * hyp )
cout<< "\n"<< "(" side1 << "\t" << side2 << "\t" << hyp << ")";
getch();
}
thanks for post this
ReplyDelete6,8,10 why not pythagorean triplet?
ReplyDeleteoutput shows 6,8,10
Deleteplease also be include output of this program...thank you
ReplyDelete