Archived
1
0
This repository has been archived on 2025-03-31. You can view files and clone it, but cannot push or open issues or pull requests.
pascal/ITG/QUERSUM.PAS
2001-11-30 12:14:44 +01:00

23 lines
418 B
Plaintext

program Quersumme;
var Zahl: longint;
function Quer(zahl: longint): integer;
var conv: string;
i,q,tmp,ec: integer;
begin
Str(zahl,conv);
q := 0;
for i:=1 to Length(conv) do begin
Val(conv[i],tmp, ec);
if ec=0 then q:=q + tmp;
end;
Quer := q;
end;
begin
Write('Tipp ''ne Ganzzahl ein: ');
ReadLn(Zahl);
WriteLn('Quersumme von ',Zahl:0,' ist ',Quer(Zahl),'.');
end.