Advertisement
katkalig

vyskytuje

Mar 30th, 2015
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.47 KB | None | 0 0
  1. program linar;
  2. uses crt;
  3. var a:array[1..20] of byte;
  4.     i,pv,x:byte;
  5. begin
  6.    clrscr;
  7.    randomize;
  8.    writeln('Zadej cislo od 0-30');
  9.    readln(x);
  10.    for i:=1 to 20 do
  11.        begin
  12.           a[i]:= random(31);
  13.           write(a[i],', ');
  14.        end;
  15.    writeln;
  16.    for i:=1 to 20 do
  17.        if a[i]=x then pv:=pv+1;
  18.    if pv>0 then writeln('Cislo ',x,' se v danem poli vyskytuje ',pv,'x.')
  19.    else
  20.    writeln('Zadane cislo se v poli nevyskytuje.');
  21. readln;
  22. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement