Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {a3mel program ta3tih enti 3dad ya3tik howa f tableau T el 3dad hedheka puissance 1-5
- T1 := el somme mta3 el chiffres pairs ou impair . dependant 3al nature mta3 el variable compteur EXEMPLE "for a :=1 to 5 do" si a est pair ta3ti somme mta3 les chiffres pairs w l 3aks s7i7
- T2 := el oppose mta3 T EXEMPLE : T := 5/25/125/625/3125 T2 := 5/52/521/526/5213 :) :) :P }
- Program puissanceTemchyWTzid ;
- uses WinCrt;
- Type
- tab = Array [1..100] of Integer ;
- var
- t,tt,y: tab ;
- a,b,c,d,e,n : Integer;
- ss : string;
- Begin;
- Repeat
- Write('a5tar 3dad 1-9 : ');
- Readln(n);
- Until n in [2..9];
- // remplissage w el affichage mta3 tableau T
- for a := 1 to 5 do
- Begin
- e := 1 ;
- for b:= 1 to a do
- e := e*n ;
- t[a] := e ;
- end;
- write('T :');
- For a := 1 to 5 do
- Write(t[a]:6);
- writeln;
- // remplissage w el affichage mta3 tableau T1 :
- for a :=1 to 5 do
- Begin
- if a mod 2 =0 then
- Begin
- str(t[a],ss);
- for b:=1 to Length(ss) do
- Begin
- val(copy(ss,b,1),c,d);
- If c mod 2 = 0 then
- tt[a] := tt[a]+c ;
- end;
- end
- Else
- Begin
- Str(t[a],ss);
- for b:=1 to Length(ss) do
- Begin
- val(copy(ss,b,1),c,d);
- if c mod 2 <> 0 then
- tt[a] := tt[a]+c ;
- end;
- end;
- end;
- write('T1 :');
- for a:=1 to 5 do
- write(tt[a]:6);
- // Remplissage w affichage mta3 T2 :
- case n of
- 6..9 : for a:=1 to 5 do
- Begin
- str(t[a],ss);
- case Length(ss) of
- 1 : y[a] := t[a] ;
- 2 : y[a] := t[a] div 10 + (t[a] mod 10)*10 ;
- 3 : y[a] := t[a] div 100 + ((t[a] mod 100)div 10)*10 + ((t[a] mod 100)mod 10)*100 ;
- 4 : y[a] := t[a] div 1000 + ((t[a] mod 1000)div 100)*10 + ((t[a] mod 100)div 10)*100 + ((t[a] mod 100)mod 10)*1000 ;
- 5 : y[a] := t[a] div 10000 + ((t[a] mod 10000)div 1000)*10 + ((t[a] mod 1000) div 100)*100+ ((t[a] mod 100)div 10)*1000 + ((t[a] mod 100)mod 10)*10000 ;
- end;
- end;
- 2..5 : for a:=1 to 5 do
- Begin
- str(t[a],ss);
- case Length(ss) of
- 1 : y[a] := t[a] ;
- 2 : y[a] := t[a] div 10 + (t[a] mod 10)*10 ;
- 3 : y[a] := t[a] div 100 + ((t[a] mod 100)div 10)*10 + ((t[a] mod 100)mod 10)*100 ;
- 4 : y[a] := t[a] div 1000 + ((t[a] mod 1000)div 100)*10 + ((t[a] mod 100)div 10)*100 + ((t[a] mod 100)mod 10)*1000 ;
- end;
- end;
- end;
- writeln;
- write('T2 :');
- for a:=1 to 5 do
- write(y[a]:6);
- end.
Advertisement
Add Comment
Please, Sign In to add comment