I think it's C. Visual Programming
but I'm not 100% sure
Answer:
True
Explanation:
True, because you can always remove the placeholder afterwards
Turn it off then turn it back on
Answer:
The solution code is written in C++
- #include <iostream>
- using namespace std;
- bool checkTriangle(int s1, int s2, int h)
- {
- if( (s1*s1 + s2*s2) == h*h ){
- return true;
- }else{
- return false;
- }
- }
- int main()
- {
- int i, j, k;
-
- for(int i=1; i <=500; i++){
-
- for(int j = 1; j <= 500; j++){
-
- for(int h = 1; h <=500; h++){
-
- if(checkTriangle(i, j, h)){
-
- cout<<"Side 1: "<<i<<" Side 2: "<<j<<" Hypothenus: "<<h<<"\n";
- }
- }
- }
-
- }
- return 0;
- }
Explanation:
Firstly, we write a function checkTriangle with three input parameters, s1, s2 and h (Line 5-12). This function will evaluate the input s1, s2 and h to check if their relationship follow the Pythagorean triple. If so, it will return true, if not, it return false.
Once the function is ready, we can create a triple-nested loop to try all possible value of side1, side2 and hypotenuse below or equal to 500 and call the checkTriangle function to examine if any combination of the values follow the Pythagorean triple relationship. If true, print the sides and hypothenus (Line 18 - 27).