From 313f91c3ba3bc8bd3446f5c43e573e0c98cdafe8 Mon Sep 17 00:00:00 2001 From: GAUZERE Julien <julien.gauzere1@etu.univ-lorraine.fr> Date: Thu, 3 Apr 2025 20:30:42 +0000 Subject: [PATCH] Ex3 --- TP.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/TP.ts b/TP.ts index 3c4ba65..e877e00 100644 --- a/TP.ts +++ b/TP.ts @@ -1,9 +1,11 @@ -function deb1() { - let j = 200; - let tab: number[] = []; // Déclaration du tableau - for (let i = 0; i < 10; i++) { - j -= 10; //point d'arret, permet de suivre les valeurs de j (Exo1) - tab[i] = j; // Stocker j dans le tableau + point d'arret pour visualiser le remplissage du tableau (Exo2) - } - return j; +function deb2(x: number, y: number) : void { + const tmp = y; + y = x; //Point d'arret x = 10, 9, 8, ..., 1 + x = tmp; //Point d'arret y = 5, 6, 7, ..., 14 + console. log(x, y); } +let x = 10; +let y = 20; +deb2(x, y); +console. log(x, y); +//Le programme peut ne pas fonctionner correctement si x ou y ne sont pas initialisés correctement -- GitLab