• Aucun résultat trouvé

3–Conceptofloops 2–FirststepswithAlgobox 1–Introduction Algobox

N/A
N/A
Protected

Academic year: 2022

Partager "3–Conceptofloops 2–FirststepswithAlgobox 1–Introduction Algobox"

Copied!
3
0
0

Texte intégral

(1)

Season 01Episode 23Algobox 0

Algobox

Season 01

Episode 23 Time frame 1 period

Objectives :

• Implement an algorithm with algobox.

• Use and understand the notion of repetitive loops in algorithm.

• Devise an algorithms with loops.

Materials :

• ICT room.

• Slideshow.

1 – Introduction 10 mns

Using a slideshow, the teachers introduces Algobox and the notion of control flow statement.

2 – First steps with Algobox 25 mns

Students have to implent some algorithms under Algobox.

3 – Concept of loops 25 mns

Using Algobox, the students implent a loop and then have to devise and implement some algo- rithms.

(2)

Algobox

Season 01

Episode 23 Document Exercices

Input – Output – Assignement

Data: A, number Begin

Input:A A2A;

Output: “The square of the input is : ”

Output:A end

1. Use Algobox to implement the algorithm.

2. Run the algorithm and fill the table out.

Input 3 −3 121

Output 2

If-then-else Statement

Data: x, number Begin

Input:x;

If x >0 then Output:x else

Output:−x end_if

end

1. Use Algobox to implement the algorithm.

2. Run the algorithm and fill the table out.

Input 3 −3 121

Output 2

Loops

Data:

counter, number;

Begin

For counter from 1 to 10 do Output: counter;

end_for end

1. Implement and run the algorithm.

2. Amend this algorithm such that it displays the multiples of 7 from 0 to 70.

Challenges

1. Use algobox to compute the table of values of f(x) = (x+ 1)2 from 1 to 10 with a step of 1.

2. An initial amount of 1000 euros is put on a bank account, with an compound interest rate of 5% (meaning each year, you add 5% of the previous year amount to your savings).

Write an algorithm to compute the savings after 15 years, then amend it so that it gives the savings after nyears, where the value of nis chosen by the user.

(3)

Algobox

Season 01

Episode 23 Document Solutions

to amend according to the new instructions

Sum of numbers

1 VARIABLES

2 depart EST_DU_TYPE NOMBRE 3 final EST_DU_TYPE NOMBRE 4 somme EST_DU_TYPE NOMBRE 5 compteur EST_DU_TYPE NOMBRE 6 DEBUT_ALGORITHME

7 AFFICHER "Valeur de départ ? "

8 LIRE depart

9 AFFICHER "Valeur de fin ?"

10 LIRE final

11 depart PREND_LA_VALEUR 0

12 POUR compteur ALLANT_DE depart A final 13 DEBUT_POUR

14 somme PREND_LA_VALEUR somme+compteur 15 FIN_POUR

16 AFFICHER "La somme vaut : "

17 AFFICHER somme 18 FIN_ALGORITHME

Saving money

1 VARIABLES

2 versement EST_DU_TYPE NOMBRE 3 epargne EST_DU_TYPE NOMBRE 4 DEBUT_ALGORITHME

5 versement PREND_LA_VALEUR 0 6 epargne PREND_LA_VALEUR 0 7 TANT_QUE (epargne <220) FAIRE 8 DEBUT_TANT_QUE

9 versement PREND_LA_VALEUR versement+1 10 epargne PREND_LA_VALEUR epargne+versement 11 FIN_TANT_QUE

12 AFFICHER "Nombre de semaine :"

13 AFFICHER versement

14 AFFICHER "Montant de l’épargne : "

15 AFFICHER epargne 16 FIN_ALGORITHME

Références

Documents relatifs

Saisir le nombre entier naturel non

Écrire l’algorithme précédent avec Algobox3. Méthode

– Quand l’ordinateur exécute une ligne du type mavariable PREND_LA_VALEUR un calcul, il e ff ectue d’abord le calcul et stocke ensuite le résultat dans mava- riable.. ◮

Compléter la ligne 8 pour que l’algorithme AlgoBox ci-dessous soit correct :.

Le programme teste l’alignement de trois points donnés par leurs

Créer un algorithme sous Algobox traçant les 21 points situés sur l'axe des abscisses et les 21 points situés sur le quart de cercle comme sur la figure ci-contre.

Pour utiliser l’image d’un nombre nb par la fonction F1 dans l’algorithme, il suffit d’utiliser le code : F1(nb) (cela peut se faire dans une affectation ou dans une

To help address these issues, Be He@lthy, Be Mobile has developed the mDementia programme that uses mHealth (whereby devices such as mobile phones, patient monitoring