Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {Волкович Максим (volkovcih.maksim.s@gmail.com), 112гр., v1.0,
- описать функцию, которая находит сумму предпоследнего и последнего элементов списка L}
- type T=real;
- list=^chain;
- chain=record elem:T; next:list end;
- function sum(L:list):real;
- var s:real; p:list;
- begin
- p:=L;
- while p^.next^.next <> nil do
- begin s:=p^.elem; p:=p^.next; end;
- sum:=s+p^.elem;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement