Professional Documents
Culture Documents
1. Spremeni izraze tako, da bodo pomenili ravno nasprotno (npr. a=4 ... a != 4 )!
a != 4
a je za 2 večji kot b
absolutna vrednost a je 3
a1 je deljiv z 10
produkt a in 3 je manjši od 16
a)
b)
a) Kaj izpiše program, če vnesemo 6? b) Ugotovite, kaj je vloga naslednje zanke!
Start Start
x←1
"Vnesi neko število!"GET n
Loop
Yes n % 10 = 7
No
x←x*2
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.