Logic and algorithms review; linear algorithms
Answers are for parents and teachers.
1
Triangle base a and height h are given. Write the linear algorithm for its area in words.
Start; input a, h; compute S = a · h / 2; output S; end.
2
The arithmetic mean of two numbers is M = (x + y) / 2. Find M for x = 14, y = 20.
17
3
For a = 4, b = 7, write a and b after t = a; a = b; b = t.
a = 7, b = 4
4
Review: for A = 1, B = 1, C = 0 find the values of A ∧ B => C and ¬(A ∨ C).
A ∧ B = 1, 1 => 0 = 0; A ∨ C = 1, ¬1 = 0. Answer: 0 and 0.