Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uses crt;
- var
- a:char;
- b:string;
- c, d, ilosc:byte;
- begin
- clrscr;
- writeln('Program podaje ile razy wystapila pierwsza cyfra');
- writeln('Aby zsumowac ilosc wpisz 0');
- writeln;
- write('Podaj ciag cyfr: ');
- repeat
- a:=readkey;
- c:=byte(a);
- if (c>=48) and (c<=57) then
- begin
- b:=b+a;
- write(a);
- d:=d+1;
- if b[d] = b[1] then
- ilosc:=ilosc+1;
- end;
- until byte(b[length(b)]) = 48;
- writeln;
- writeln('Liczba ', b[1], ' pojawila sie ', ilosc,' razy');
- readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment