Advertisement
Sawy3R11

Z3

Jan 18th, 2016
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.07 KB | None | 0 0
  1. program project1;
  2. var
  3.    tablica : array [0..3] of char;
  4.    i, licznik : integer;
  5.    znak : char;
  6. function ile_malych(tablica : array of char) : integer;
  7. begin
  8.   licznik := 0;
  9.   for i:=0 to 10 do
  10.         if (tablica[i] in ['a'..'z']) then licznik := licznik +1;
  11.   ile_malych:= licznik;
  12. end;
  13. function ile_znak(tablica : array of char; znak : char) : integer;
  14. begin
  15.      ile_znak:=0;
  16.      for i:=0 to 10 do
  17.      begin
  18.          if (tablica[i] = znak) then ile_znak := ile_znak +1;
  19.      end;
  20. end;
  21.  
  22. function suma( tablica: array of char):integer;
  23. begin
  24.     suma:=0;
  25.     for i:=0 to 10 do
  26.     begin
  27.         if (tablica[i] in ['0'..'9']) then suma:= suma+(integer(tablica[i])-integer('0')) ;
  28.     end;
  29. end;
  30.  
  31. begin
  32.  
  33.    for i:=0 to 3 do
  34.        Readln(tablica[i]);
  35.    for i:=0 to 3 do
  36.        Writeln(tablica[i]);
  37.    writeln(#10#13, 'Liczba malych liter: ', ile_malych(tablica));
  38.    writeln(' Podaj znak: ');
  39.    readln (znak);
  40.    writeln(#10#13, 'o podanym znaku jest:   ', ile_znak(tablica, znak));
  41.  
  42.    writeln(#10#13, 'suma:   ', suma(tablica));
  43.  
  44.    readln();
  45. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement