Sunday, 4 October 2015

Pythagorean triplets in the range 1 to 20 using funcion

#include<stdio.h>
#include<conio.h>
void main()
{
void p();
clrscr();
p();

getch();
}
void p()
{
int s1,s2,hpy;
printf("p between 1 to 20");
for(s1=1;s1<=20;s1++)
for(s2=1;s2<=20;s2++)
for(hpy=1;hpy<=20;hpy++)
if((s1*s1+s2*s2)==hpy*hpy)
printf("\n%d %d %d",s1,s2,hpy);
}



No comments:

Post a Comment