Lecture
In the record of logical expressions, in addition to arithmetic operations of addition, subtraction, multiplication, division and exponentiation, the following operations are used: <(less), <= (less than or equal),> (greater),> = (greater than or equal), = (equal ), <> (not equal), and also logical operations and, or, not.
| Condition | Record in school algorithmic language | 
| The fractional part of the real number a is zero | int (a) = 0 | 
| Integer a is even | mod (a, 2) = 0 | 
| Integer a is odd | mod (a, 2) = 1 | 
| Integer k is a multiple of seven | mod (a, 7) = 0 | 
| Each of the numbers a, b is positive. | (a> 0) and (b> 0) | 
| Only one of the numbers a, b is positive. | ((a> 0) and (b <= 0)) or ((a <= 0) and (b> 0)) | 
| At least one of the numbers a, b, c is negative. | (a <0) or (b <0) or (c <0) | 
| The number x satisfies the condition a <x <b | (x> a) and (x <b) | 
| The number x has a value in the interval [1, 3] | (x> = 1) and (x <= 3) | 
| Integers a and b have the same parity | ((mod (a, 2) = 0) and (mod (b, 2) = 0) or ((mod (a, 2) = 1) and (mod (b, 2) = 1))) | 
| The point with coordinates (x, y) lies in a circle of radius r centered at the point (a, b) | (xa) ** 2 + (yb) ** 2 <r * r | 
| The equation ax ^ 2 + bx + c = 0 has no real roots. | b * b - 4 * a * c <0 | 
| Point (x, y) belongs to the first or third quarter | ((x> 0) and (y> 0)) or ((x <0) and (y> 0)) | 
| The point (x, y) belongs to the exterior of the unit circle centered at the origin or its second quarter | (x * x + y * y> 1) or ((x * x + y * y <= 1) and (x <0) and (y> 0)) | 
| Integers a and b are mutually opposite | a = -b | 
| Integers a and b are reciprocal | a * b = 1 | 
| The number a is greater than the arithmetic mean of the numbers b, c, d | a> (b + c + d) / 3 | 
| The number a is not less than the average of the geometric numbers b, c, d | a> = (b + c + d) ** (1/3) | 
| At least one of the logical variables F1 and F2 is yes | F1 or F2 | 
| Both logical variables F1 and F2 are yes. | F1 and F2 | 
| Both logical variables F1 and F2 are none. | not F1 and not F2 | 
| The logical variable F1 is set to yes , and the logical variable F2 is set to no | F1 and not F2 | 
| Only one of the logical variables F1 and F2 matters yes. | (F1 and not F2) or (F2 and not F1) | 
Comments
To leave a comment
Programming Languages and Methods / Translation Theory
Terms: Programming Languages and Methods / Translation Theory