PnnK

task16

Jul 18th, 2021
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.24 KB | None | 0 0
  1. function f( n : integer) : integer;
  2. begin
  3.   if n <= 1 then result := 0;
  4.   if (n>1) and (n mod 2 = 0) then result := n div 2 + f(n-1) + 2;
  5.   if (n>1) and (n mod 2 = 1) then result := f(n-1) + 3*n*n;
  6. end;
  7.  
  8.  
  9. begin
  10.   print(f(49));
  11. end.
Advertisement
Add Comment
Please, Sign In to add comment