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.

egin ClrScr;<br />

A:= 'a'; B:= 'b';<br />

Raksta(7); writeln(A:3, B:3);<br />

Skaita; writeln(A:3, B:3);<br />

readln; end.<br />

Pk5-3. Atrast kļūdas programmas fragmentos un paskaidrot tās.<br />

a) function Liels(A,B: integer): integer;<br />

begin if A> B then Liels:= A; end;<br />

b) function Summa(Skaits: integer): integer;<br />

var L: integer;<br />

begin Summa:= 0;<br />

for L:=1 to Skaits do Summa:= Summa + L; end;<br />

Pk5-4. Noteikt summas 1!+2!+3!+4!+5! vērtību.<br />

Pk5-5. Noteikt summas 1/a +1/a 2 +1/a 3 +1/a 4 + ... +1/a n vērtību patvaļīgai naturāla<br />

skaitļa n vērtībai.<br />

Pk5-6. Izvadīt tabulas veidā summu<br />

· 1 +1/2+1/3 +1/4 + ... +1/n<br />

· 1 + 1/2 2 + 1/3 2 +1/4 2 + ... +1/n 2<br />

· 1/3 2 + 1/5 2 +1/7 2 + ... +1/(2n+1) 2<br />

· 1! +2!/(1+1/2) +... +n!/(1 +1/2 + ... 1/n)<br />

vērtības naturāla skaitļa n vērtībām intervālā (5, 10).<br />

Pk5-7. Izveidot funkcijas y = 3x 5 + 2 x 3 - 7 x 2 + x -8 vērtību tabulu intervālā (1,15) ar<br />

soli 2.<br />

Pk5-8. Izveidot dotās programmas, kura nosaka ar virsotņu koordinātēm uzdota četrstūra<br />

ABCD laukumu, komentārus. Papildināt programmu tā, lai tiktu izvadīti atsevišķu<br />

trīsstūru laukumi. Pārbaudīt risinājumu izvēloties citu četrstūra dalījumu. Pārveidot<br />

programmu tā, lai tiktu izmantotas funkcija un procedūra.<br />

program laukums4stur;<br />

uses crt;<br />

var xA,yA,xB,yB,xC,yC,xD,yD:integer;<br />

a,b,c,d,e,AB,BC,CD,AD,DB,L,p1,p2,T1,T2:real;<br />

begin<br />

clrscr;<br />

writeln (Ievadi koordinates xA, yA, xB, yB, xC, yC, xD, yD ');<br />

writeln;<br />

write(' xA= '); readln(xA);<br />

write(' yA= '); readln(yA);<br />

write(' xB= '); readln(xB);<br />

write(' yB= '); readln(yB);<br />

write(' xC= '); readln(xC);<br />

write(' xC= '); readln(yC);<br />

51

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

Saved successfully!

Ooh no, something went wrong!