Integer comparison: Difference between revisions
Content added Content deleted
Line 30: | Line 30: | ||
=={{header|ALGOL 68}}== |
=={{header|ALGOL 68}}== |
||
{{works with|ALGOL 68|Standard - no extensions to language used}} |
|||
⚫ | |||
Note: the standard includes the characters "≤", "≥" and "≠". These appear |
|||
INT a, b; |
|||
in the character sets [[wp:ALCOL]], [[wp:GOST 10859]], [http://www.w3.org/TR/REC-MathML/chap6/ISOTECH1.html ISOtech] and |
|||
readf(($g" "gl$, a, b)); |
|||
IBM's [[:wp:EBCDIC]] code pages e.g. [http://www-01.ibm.com/software/globalization/cs/cs01340.jsp code page 1340]. |
|||
⚫ | |||
{{works with|ALGOL 68G|Any - tested with release mk15-0.8b.fc9.i386}} |
|||
⚫ | |||
{{works with|ELLA ALGOL 68|Any (with appropriate job cards) - tested with release 1.8.8d.fc9.i386}} |
|||
⚫ | |||
The current distribution of both [[ALGOL 68G]] and [[ELLA ALGOL 68]] compilers only |
|||
⚫ | |||
allow [[wp:ASCII]] characters (ASCII has neither "≤", "≥" nor "≠" characters). |
|||
⚫ | |||
⚫ | |||
⚫ | |||
INT a, b; |
|||
read((a, space, b, new line)); |
|||
) |
|||
IF a <= b OR a LE b # OR a ≤ b # THEN |
|||
print((a," is less or equal to ", b, new line)) |
|||
FI; |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
FI; |
|||
IF a /= b OR a NE b # OR a ≠ b # THEN |
|||
print((a," is not equal to ", b, new line)) |
|||
FI; |
|||
IF a >= b OR a GE b # OR a ≥ b # THEN |
|||
print((a," is greater or equal to ", b, new line)) |
|||
FI |
|||
)</pre> |
|||
Example output: |
|||
<pre> |
|||
3 4 |
|||
+3 is less or equal to +4 |
|||
+3 is less than +4 |
|||
+3 is not equal to +4 |
|||
</pre> |
|||
=={{header|AWK}}== |
=={{header|AWK}}== |