You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//Description:a program that uses brute-force computing to determine the integer sets of Pythagorean triples up to a limit set by the user. The user inputs a maximum integer length of the hypothenuse side of the triangle.
#include <stdio.h>
int main() {
int a, b, c, k;
while (1) {
// prompts the user for the length of hypothenuse
printf("Enter a length of hypothenuse (enter 0 to stop): ");
scanf("%d", &k);
// program ends if length is zero
if (k == 0) {
break;
}
// checks if the value is less than 4
if (k <= 4) {
printf("Enter an integer larger than 4.\n");
continue;
}
// The for loops are used to iterate over all possible values of a, b, and c