Featured
- Get link
- X
- Other Apps
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";
}
- Get link
- X
- Other Apps
Labels:
C++ program to print pythagoran triplets between 1 to 1000
pytha goran triplets program in C++
Popular Posts
C++ program to display numbers which get reversed after multiplying by 4
- Get link
- X
- Other Apps
Comments
Post a Comment