#include<stdio.h>
#include<conio.h>
void main()
{
int side1,side2,hyp;clrscr();
printf("Pythagorean triples between 1 to 20 :");
for(side1=1;side1<=20;side1++)
for(side2=1;side2<=20;side2++)
for(hyp=1;hyp<=20;hyp++)
if((side1*side1+side2*side2)==hyp*hyp )
printf("\n %d %d %d",side1,side2,hyp);
getch();
}
#include<conio.h>
void main()
{
int side1,side2,hyp;clrscr();
printf("Pythagorean triples between 1 to 20 :");
for(side1=1;side1<=20;side1++)
for(side2=1;side2<=20;side2++)
for(hyp=1;hyp<=20;hyp++)
if((side1*side1+side2*side2)==hyp*hyp )
printf("\n %d %d %d",side1,side2,hyp);
getch();
}
No comments:
Post a Comment