------------------------------------------ Вариант 1 ------------------------------------------ function sum(num: longint): longint; var digit, s: longint; begin s := 0; while(num <> 0) do begin digit := num mod 10; s := s + digit; num := num div 10; end; sum := s; end; var num: longint; begin read(num); writeln(sum(num)); end. ------------------------------------------ Вариант 2 ------------------------------------------ function sum(num: longint): longint; begin if (num > 0) then sum := sum(num div 10) + (num mod 10) else sum := 0; end; var num: longint; begin read(num); writeln(sum(num)); end. ------------------------------------------ Вариант 3 ------------------------------------------ var num, d1, d2, d3, sum: longint; begin read(num); d1 := num mod 10; d2 := num div 10 mod 10; d3 := num div 100; sum := d1 + d2 + d3; writeln(sum); end.