1. Swapping values
We want to make a program that reverses the content of two variables a and b.
Has. Explain why the program below is not working.
B. Change the program so that the value of both variables a and b is reversed.
2. While Loop
The while statement allows you to run a loop. The indented instructions will be executed as long as the specified condition after the while statement is true.
Has. Without running the program, what are the numbers displayed in the program below?
If you are experiencing difficulties so far, I invite you to watch this video in order to analyze the program and its operation, otherwise continue your journey.
B. Run the program to confirm the previous guess.
C. Change the program to show numbers from 1 to 15.
D. Change the program to show all even numbers from 2 to 18.
E. Change the program to “end the program” after each number instead of displaying it only at the end of the program.
3. First function
The following program displays “ABC is rectangle in A” if the ABC triangle is rectangle in A.
Has. What does the carre function return?
B. What criteria does the program use to determine if the triangle is rectangle in A?
C. Complete the program to also determine if the triangle is rectangle in B or C.