GamerSK

kolkocisielmam

Jan 16th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.87 KB | None | 0 0
  1. //napiste program ktory zisti kolko krat sa zadane cislo vyskytuje mezdi n zadanymi cislami
  2. program kolkocisielmam;
  3. {$APPTYPE CONSOLE}
  4. uses
  5.   SysUtils;
  6.  
  7. var cislo:string;
  8.     i,a,b,c,d,e,f,g,h,j:byte;
  9. begin
  10.   { TODO -oUser -cConsole Main : Insert code here }
  11.   write('Lubovolne cislo: ');
  12.   readln(cislo);
  13.   a:=0;
  14.   b:=0;
  15.   c:=0;
  16.   d:=0;
  17.   e:=0;
  18.   f:=0;
  19.   g:=0;
  20.   h:=0;
  21.   j:=0;
  22.   for i:=1 to length(cislo) do
  23.     begin
  24.       case cislo[i] of
  25.         '1':a:=a+1;
  26.         '2':b:=b+1;
  27.         '3':c:=c+1;
  28.         '4':d:=d+1;
  29.         '5':e:=e+1;
  30.         '6':f:=f+1;
  31.         '7':g:=g+1;
  32.         '8':h:=h+1;
  33.         '9':j:=j+1;
  34.       end;
  35.     end;
  36.   writeln('1 = ',a);
  37.   writeln('2 = ',b);
  38.   writeln('3 = ',c);
  39.   writeln('4 = ',d);
  40.   writeln('5 = ',e);
  41.   writeln('6 = ',f);
  42.   writeln('7 = ',g);
  43.   writeln('8 = ',h);
  44.   writeln('9 = ',j);
  45.   readln;
  46. end.
Advertisement
Add Comment
Please, Sign In to add comment