Outside the middle school program / A few algorithms 3 exercises (100% corrected)

a
AetBdeux nombresLerestedeladivisiondeAparBvaut 0?Le PGCD estBˆAprend pour valeurBˆBprend pour valeurrOn e∑ectue la division euclidienne deAparBOuiNonABCD1D2 1. Algorithm and AlgoBox E.3392 1 In the programming language of your choice, enter the function below : Function f(a) For i ranging from 1 to 100 c remainder of the division euclidean of a by b End For 2 Running a step-by-step execution of the function f with the argument b =3 , what are the values assigned to the variable c . E.3390 The program below represents the PGCD algorithm by successive subtraction for AlgoBox soft-ware. Function f(a,b) As long as a b =0 M max(a;b) b min(a; b) a M c a b a c End As long as 1 Write this program in the language of your choice. 2 Call the function f with the values a =541 and b =24 . When calling this function f step by step in the algo-rithm, note the values of the variables a , b and c at each end of loop execution. E.3391 Here is a diagram showing Euclid’s al-gorithm : 1 In the table below, determine the GCD of the numbers 541 and 24 : A B r 2 Hier ist eine Schreibweise dieses Algorithmus durch die Funktion f , die zwei natürliche Zahlen als Argumente nimmt. Function f(a,b) While ... r remainder of the Euclidean division of a and b a ... b ... End While r 0 Return b Complete the missing parts of this algorithm. https://chingmath.fr chapExoCorrec/3392 sacados/3392 chapExoCorrec/3390 sacados/3390 chapExoCorrec/3391 sacados/3391 AetBdeux nombresLerestedeladivisiondeAparBvaut 0?Le PGCD estBˆAprend pour valeurBˆBprend pour valeurrOn e∑ectue la division euclidienne deAparBOuiNonABCD1D2