Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Where a<b<c and a^2+b^2=c^2. Write a program in C which takes the positive integ

ID: 3544311 • Letter: W

Question

Where a<b<c and a^2+b^2=c^2. Write a program in C which takes the positive integer n as the input and prints out the following:-

1The total number of pythogorean triples (a,b,c) with c<N

2) Every such pythogorean triple,

3)That prints the triple which when taken as the three side lengths of a right-angled triangle it gives rise to the thinnest triangle. Here, a right angled triangle is said to be thinner than another right angled triangle if the smallest interior angle of the first triangle is smaller than that of the second triangle.

Explanation / Answer

#include<stdio.h>

int main()

{

int n,a,b,c;

printf("enter n");

scanf("%d",&n);

int count=0;

for(a=1;a<=n;a++)

for(b=1;b<=n;b++)

for(c=1;c<=n;c++)

{

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

{

count++;

printf("%d %d %d ",c ,a,b);

}

}

printf("total no. of sets is %d",count );


}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote