Une solution de l'exercice 1 du TP n°7

program tp7exc1;
VAR T  : array[0..10,0..10] of integer;
    i,j  : integer;
    choix :  char;

BEGIN
   (* choix par l'utilisateur *)
   writeln('voulez-vous :');
   writeln('-1- la table d''addition');
   writeln('-2- la table de multiplication');
   repeat
      write('? ');
      readln(choix);
      until (choix='1') or (choix='2');
   writeln;
   (* remplissage du tableau correspondant au choix *)
   for i:=0 to 10 do
      for j:=0 to 10 do
  if choix='1' then T[i,j]:=i+j else T[i,j]:=i*j;
   (* affichage de la table *)
   for i:=0 to 10 do
       begin
       for j:=0 to 10 do write(T[i,j]:4);
       writeln;
       end;
END.