Informatique

Question

Bonjour, quelqu'un pourrait m'aider à résoudre cet algorithme ? Merci !
Bonjour, quelqu'un pourrait m'aider à résoudre cet algorithme ? Merci !

1 Réponse

  • Bonsoir,

    Algorithmie:

    T [tex]\leftarrow[/tex] 1;

    i [tex]\leftarrow[/tex] 2;

    prod [tex]\leftarrow[/tex] 1;

    Tant que (i < 11) faire

       prod [tex]\leftarrow[/tex] prod * i;

       T [tex]\leftarrow[/tex] T + 1 / prod;

       i [tex]\leftarrow[/tex] i + 1;

    ftantque;

    Ecrire(T);

    En Python:

    T, i, prod = 1, 2, 1

    while i < 11:

       prod *= i

       T += 1/prod

       i += 1

    print(T)

    On trouve environ 1.7182818011463847

    Bonne soirée.