Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program Behi ;
- uses WinCrt;
- var
- t : array[1..100] of integer ;
- a,n,s : integer ;
- k : char;
- procedure ebda(var s : integer ; var n : Integer; var k :char );
- Begin
- s := 0 ;
- WriteLn('9adeh men case t7ab fel tableau mte3ek (max 100 ) ');
- readln(n);
- Writeln('t7ab t3aby el tableau MANUALLY wala RANDOM ? tap m/M for MANUALLY or r/R for RANDOM ');
- readln(k);
- End;
- Procedure FM( var n : integer) ;
- Begin
- for a := 1 to n do
- Begin;
- Write('7ot el contenu mta3 el case n°',a,': ');
- readln(t[a]);
- end;
- end;
- procedure FR( var n : integer) ;
- Begin
- for a := 1 to n do
- t[a] := Random(999);
- End;
- Procedure fail( var s : integer) ;
- Begin
- for a := 1 to 50 do
- WriteLn('3awed mellowel rak 8alet');
- end;
- procedure tab( var n : integer ) ;
- Begin
- for a := 1 to n do
- write(t[a],' ');
- writeln;
- end;
- Procedure ts(var s : integer; var n : Integer );
- Begin
- write('les nombres pairs sont : ');
- for a := 1 to n do
- Begin;
- If t[a] mod 2 = 0 then
- Begin;
- if s = 0 then
- WriteLn(t[a])
- Else
- writeln(t[a]:26);
- s := s + t[a] ;
- End;
- End;
- End;
- Begin
- ebda(n,s,k);
- if Upcase(k) = 'M' then
- Begin
- FM(n);
- tab(n);
- ts(s,n);
- WriteLn('el somme mta3 el entiers pairs fel tableau mte3ek : ',s);
- End
- Else
- If Upcase(k) = 'R' then
- Begin;
- FR(n);
- tab(n);
- ts(s,n);
- WriteLn('el somme mta3 el entiers pairs fel tableau mte3ek : ',s);
- end
- Else
- Begin ;
- fail(s);
- End;
- end.
Add Comment
Please, Sign In to add comment