You are on page 1of 6

Ime in priimek: Razred: R1.

Diagrami poteka – vaje

Pišite v ta dokument. Diagrame poteka prilepite in prilagodite glede na velikost lista.


Ko ste datoteko shranili, jo prilepite kot objekt kar v Word dokument. Oddajte v spletno učilnico.
Označite vrstico z imenom in priimkom in jo skrijte. (označi/desni klik/pisava/skrito).

1. Spremeni izraze tako, da bodo pomenili ravno nasprotno (npr. a=4 ... a != 4 )!

a != 4

x je med vključno 5 in vključno 10

(število < 2) V ( število >6)

(z > 7) & (z < 10)

2. Zapiši izjave kot izraze!

a je za 2 večji kot b
absolutna vrednost a je 3

a1 je deljiv z 10

obseg kroga s polmerom r je manjši od 10

produkt a in 3 je manjši od 16

Zadnji dve števki v številu sta 73

Zadnja števka v številu je liha in večja od 3

3. Odgovorite na spodnja vprašanja:

a)

b)
a) Kaj izpiše program, če vnesemo 6? b) Ugotovite, kaj je vloga naslednje zanke!

Start Start

"Vnesi celo število n:"GET n Loop

x←1
"Vnesi neko število!"GET n

Loop
Yes n % 10 = 7

No

x←x*2

n←n-1 PUT "Končno!"¶

Yes n=0 End


No

PUT "Rezultat je "+x+". "¶

End
4. Katapult lahko zabriše skalo na razdaljo od 70 do 450 m. Naredite diagram poteka, ki bo pogledal, ali lahko
ustrelite na razdalji, ki jo vnesete v program (program vpraša za število)! Program naj izpiše, ali je strel mogoč
ali ne.
5. Naredite algoritem, ki bo simuliral met kovanca. Uporabite funkcijo Random, ki da neko število na intervalu
[0, 1). Izpiše naj »cifra« ali »mož«.
6. Lokostrelec ustreli petkrat, pri čemer naredi 20 – 50 damage. Naredite diagram poteka, ki bo izpisal vsak
zadetek in skupno vsoto zadetkov. Po želji: 35% možnosti za 2x critical hit damage.
Archer fires shot #1 for 29 damage.
Archer fires shot #2 for 49 damage.
Archer fires shot #1 for 35 damage.
Archer fires shot #1 for 21 damage.
Archer fires shot #1 for 45 damage.
Total damage: 179.
Math (Non-Trigonometric) Functions

ABS
variable <- abs(math_expression)

abs returns the absolute value of a mathematical expression. For example, abs(-3.7) is 3.7, and abs(23) is 23.

CEILING
variable <- ceiling(math_expression)

ceiling returns the lowest integer value greater than or equal to the provided argument. For example, ceiling(15.9) is 16, ceiling(3.1) is
4, ceiling(-4.1) is -4, and ceiling(23) is 23.

FLOOR
variable <- floor(math_expression)

floor returns the highest integer value less than or equal to the provided argument. For example, floor(15.9) is 15, floor(3.1) is 3, floor(-
4.1) is -5, and floor(23) is 23.

MAX
variable <- max(math_expression, max_expression)

max returns the maximum of the two provided arguments. For example, max(5,7) returns 7.

MIN
variable <- min(math_expression, max_expression)

min returns the minimum of the two provided arguments. For example, min(5,7) returns 5.

PI
radians <- degrees * (pi / 180)

pi returns the ratio of a circle's circumference to its diameter (approximately 3.14159). This is a constant function that takes no
arguments and always returns the same value.

RANDOM
variable <- random

random takes no arguments. The function returns a random number in the range [0.0,1.0). That is, it may sometimes return 0.0 but will
never return 1.0. To generate a random integer from 1 to n, use floor((random*n) + 1). For example, you can simulate the roll of a die
(random number from 1 to 6) with floor((random * 6) + 1).

SQRT
variable <- sqrt(math_expression)

sqrt returns the square root of the provided argument. A negative argument results in a run-time error in the program.

sqrt(16) returns 4.

You might also like