program sumcharacter;
uses wincrt;
var teks : string;
banyak: array ['A'..'Z'] of byte;
i : byte ;
begin
write('write a word:'); readln(teks);
for i:=1 to length(teks) do
banyak[upcase(teks[i])] := banyak[upcase(teks[i])] + 1;
for i:=1 to 26 do
if (banyak[upcase(chr(64+i))] <>0) then
writeln(upcase(chr(64+i)),' sum =' ,banyak[upcase(chr(64+i))]);
end.
if we run the statement,we are get output like this :
No comments:
Post a Comment