LOVEGUN

Exercice 5 (Série #3) (Classe)

Apr 14th, 2021 (edited)
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.37 KB | None | 0 0
  1. Program ex5;
  2. Uses Wincrt;
  3. Var
  4.   n,i: Integer;
  5.   s: Real;
  6.  
  7. Function puis (a,b:Integer): Integer;
  8. Var
  9.   i,s: Integer;
  10. Begin
  11.   s := 1;
  12.   For i:=1 To b Do
  13.     s := s*a;
  14.   puis := s;
  15. End;
  16. Begin
  17.   Repeat
  18.     Writeln ('Donner un entier positif') ;
  19.     Readln (n) ;
  20.   Until n>0 ;
  21.   s := 0;
  22.   For i:=1 To n Do
  23.     s := s+((2*i-1)/puis(i,i));
  24.   Writeln (s);
  25. End.
  26.  
Add Comment
Please, Sign In to add comment