daily pastebin goal
2%
SHARE
TWEET

Untitled

a guest May 16th, 2018 101 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. N = 6;
  3. var
  4. a:array[0..N-1] of integer;
  5. i,j,k:integer;
  6. begin
  7.       for i:=0 to N-1 do readln(a[i]);
  8.      
  9.       k:=-1;
  10.       for i:=2 to N-2 do
  11.       begin
  12.           if(a[i] < a[i-1]) and (a[i] < a[i+1]) and
  13.           ((a[i] < k) or (k = -1))then
  14.           begin
  15.                 k := a[i];
  16.           end;
  17.       end;
  18.      
  19.       writeln(k);
  20.      
  21.      
  22.       readkey;
  23. end.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top