04.02.2015 Views

"Datormācība. Skaitlisko aprēķinu realizācijas metodes ...

"Datormācība. Skaitlisko aprēķinu realizācijas metodes ...

"Datormācība. Skaitlisko aprēķinu realizācijas metodes ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Pk2-7. Jāizmanto operātors:<br />

if ((a+b)>c) and ((a+c)>b) and ((c+b)>a) then<br />

write('var uzkonstruet trijsturi') else write('nevar uzkonstruet<br />

trijsturi').<br />

Pk3-1. a) 6 8 10 12 14 16<br />

b) 1; 99 2; 98 3; 97 4; 96 5; 95<br />

c) ** 6** 7** 8** 9** 10<br />

d) 13 14 15 16 17 18 19 20 21<br />

Pk3-2. a) for i:=1 to 5 do writeln(i);<br />

b) Summa:=0;<br />

for i:=1 to 10 do begin<br />

read(Skaitlis);<br />

Summa:=Summa+Skaitlis;<br />

end;<br />

writeln (Summa:15);<br />

Pk3-3. for i:=3 to 10 do writeln(13-i:13-i);<br />

Pk3-4. Summa:=0;<br />

for i:=4 downto 1 do begin<br />

writeln('*':15-i);<br />

Summa:=Summa+(5-i);<br />

writeln(Summa);<br />

end;<br />

Pk3-5. Var izmantot operātorus: sum:=0;<br />

for i:= a to b do sum:=sum+sqr(i);<br />

write(sum);<br />

Pk3-6. Var izmantot operātorus: r:=1;<br />

for i:= a to b do r:=r*i;<br />

write(r);<br />

Svarīgi izsekot tam, lai reizinājums r nepārsniegtu tā definīcijas<br />

apgabalu.<br />

Pk3-7. Var izmantot operātorus: b:=0;<br />

for i:= 1 to 100 do begin a:= random(n);<br />

if a>b then b:=a; end;<br />

write(b);<br />

Pk3-8. Var izmantot operātorus:<br />

for i:= 1 to 100 do begin a:= random(n);<br />

if (an/3) and (a

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!