Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Program exrevision;
- Uses Wincrt;
- Type
- tab = Array [0..100] Of Integer;
- Var
- n,nt,s: Integer;
- Procedure fibo (n:Integer;Var nt,s:Integer);
- Var
- i,p: Integer;
- t: tab;
- Begin
- t[0] := 1;
- t[1] := 1;
- s := 2;
- For i:=2 To n Do
- Begin
- If i Mod 2=0 Then
- Begin
- p := i Div 2;
- t[i] := (t[p-1]*t[p-1])+(t[p]*t[p]);
- End
- Else
- Begin
- p := (i-1) Div 2;
- t[i] := (2*t[p+1]-t[p])*t[p];
- End;
- s := s+t[i];
- End;
- nt := t[n];
- End;
- Begin
- Writeln ('Saisir N: ');
- Readln (n);
- fibo(n,nt,s);
- Writeln (nt);
- Writeln ('somme: ',s);
- End.
Add Comment
Please, Sign In to add comment