Skip to main content

Featured

functions in Python

C++ program to print pythagoran triplets between 1 to 1000




If you are looking for a C++ program which prints pythagoran triplets between 1 to 1000, you will find the program here.



What is pythagoran triplet?

A group of 3 numbers a,b,c where c2=a2+b2.





Here is the program: 



#include<iostream.h>

#include<conio.h>

void pytha(long int,long int,long int);

void main()

{   clrscr();

    long int i,j,k;

for(i=1;i<=100;++i)

{

for(j=1;j<i;++j)

{

   for(k=1;k<j;++k)

   {

pytha(i,j,k);

   }

}

}

getch();

}

void pytha(long int a,long int b,long int c)

{

if((a*a)==(b*b)+(c*c))

cout<<" Pythagoran triplets-->"<<a<<" "<<b<<" "<<c<<"\n";

}


Comments

Popular Posts