10.1.. Izračunati sumu članova niza čija je vrijednost u intervalu [3,9]. 

Opis programa:

Listing programa:

PROGRAM P10112051;
USES
  WinCrt;
CONST 
  n = 50;
VAR
VAR
 i : longint;
 x : ARRAY [1..n] OF longint;
 s : longint;
BEGIN
  WRITELN('Suma clanova >=3 i <=9');
  WRITELN('Upisati clanove niza: ');
  FOR i := 1 TO n DO
    BEGIN
      WRITE(i,' --> ');
      READLN(X[i]);
    END;
  s:=0;
  FOR i:=1 TO n DO
    IF (x[i]>=3) AND (x[i]<=9) THEN
      s:=s+x[i];
  WRITELN('Suma clanova >=3 i <=9: ',s);
END.

Ispis na ekranu:

Index