Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

samedi 25 avril 2020

Baccalauréat 2009 SI Sujet 2 Corrigé

Program S2; Var n : integer; suite : text; //*********************************** Procedure saisie(Var n : integer); Begin Repeat write('donner n :'); readln(n); Until (n>999)And(n<10000); End; //*********************************** Function tric(ch : String) : string; Var i,j : integer; c : char; Begin For i:= 1 To length(ch) Do For j:=1 To length(ch)-1 Do If ch[j]>ch[j+1] Then Begin c := ch[j]; ch[j] := ch[j+1]; ch[j+1] := c; End; tric := ch; End; //*********************************** Function trid(ch : String) : string; Var i,j : integer; c : char; Begin For i:= 1 To length(ch) Do For j:=1 To length(ch)-1 Do If ch[j]<ch[j+1] Then Begin c := ch[j]; ch[j] := ch[j+1]; ch[j+1] := c; End; trid := ch; End; //*********************************** Procedure traitement(n : integer); Var ch,ch0,ch1 : string; nbre,up,u,min,max,e : integer; Begin str(n,ch); writeln(suite,ch); ch0 := tric(ch); writeln(ch0); readln; ch1 := trid(ch); writeln(ch1); readln; val(ch0,min,e); val(ch1,max,e); u := max-min; nbre := 0; Repeat write(up,' '); readln; up := u; str(u,ch); writeln(suite,ch); ch0 := tric(ch); ch1 := trid(ch); val(ch0,min,e); val(ch1,max,e); u := max-min; Until up-u=0; End; //*********************************** Begin assign(suite,'c:\bac2009\suite.txt'); rewrite(suite); saisie(n); traitement(n); close(suite); End.
 
Back to top