{ CIFSUCET.PAS Copyright (c) fake man } { } { Program určí ciferný súčet n-čísel plus ešte niečo k tomu } { (stačí si prečítať program) } { } { Author: fake man } { Date : 15.12.2010 http://www.trsek.com } program cif_sucet_n_cisel; uses crt; var n,i,cislo,k,z,zsucet,ksucet,sucet:integer; begin clrscr; write('zadaj pocet cisel ktorych chces ciferny sucet');read(n); k:=0;z:=0;zsucet:=0;ksucet:=0;sucet:=0; for i:=1 to n do begin write('napis',i,'. cislo');read(cislo); if cislo>0 then begin k:=k+1; while cislo<>0 do begin ksucet:=ksucet+cislo mod 10; cislo:=cislo div 10 end; end; if cislo<0 then begin z:=z+1; while cislo<>0 do begin zsucet:=zsucet + abs(cislo mod 10); cislo:=cislo div 10; end; end; end; sucet:=zsucet+ksucet; writeln('zapornych cisel je ',z,' ich sucet je ',zsucet); writeln('kladnych cisel je ',k,' ich sucet je ',ksucet); writeln('sucet vsetkych cisel je ',sucet);readln;readln; end.