dimanche 25 septembre 2016
    1. Program Toute_Lettre;
    2. Const Chiffres : Array[0..19] of String =('','un','deux','trois','quatre','cinq','six','sept','huit','neuf','dix','onze','douze','treize','quatorze','quinze','seize','dix-sept','dix-huit','dix-neuf');
    3. Dizaines : Array[2..9] of String = ('vingt','trente','quarante','cinquante','soixante','','quatre-vingt','');
    4. Var n : Integer;
    5. result : String;
    6. Begin
    7. Writeln ('Donner un entier entre 0 et 99');
    8. Readln (n);
    9. Case n of
    10. 0..19 : result := Chiffres [n];
    11. 20..69,80..89: If ((n mod 10 = 1) and (n<>81)) Then result := Dizaines [n div 10] + ' et ' + Chiffres [n mod 10]
    12. Else
    13. result := Dizaines [n div 10] + ' ' + Chiffres [n mod 10];
    14. 70..79,90..99: If (n = 71) Then result := Dizaines [n div 10 -1] + ' et ' + Chiffres [n mod 10 + 10]
    15. Else
    16. result := Dizaines [n div 10 -1] + ' ' + Chiffres [n mod 10 + 10];
    17. End;
    18. If n=0 Then Writeln ('zéro')
    19. Else
    20. Writeln (result);
    21. End.

0 commentaires:

Enregistrer un commentaire

Page Facebook

Turbo Pascal 32 bits

Turbo Pascal 64 bits