September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
9
Task/Integer-comparison/Astro/integer-comparison.astro
Normal file
9
Task/Integer-comparison/Astro/integer-comparison.astro
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
let a = scan('Enter value of a: ')
|
||||
let b = scan('Enter value of b: ')
|
||||
|
||||
if a < b:
|
||||
print 'a is less than b'
|
||||
elif a > b:
|
||||
print 'a is greater than b'
|
||||
elif a == b:
|
||||
print 'a is equal to b'
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
CLS
|
||||
INPUT "a, b"; a, b 'remember to type the comma when you give the numbers
|
||||
PRINT "a is ";
|
||||
IF a < b THEN PRINT "less than ";
|
||||
IF a = b THEN PRINT "equal to ";
|
||||
IF a > b THEN PRINT "greater than ";
|
||||
PRINT "b"
|
||||
INPUT "Enter first number " ,a
|
||||
INPUT "Enter second number " ,b
|
||||
IF a < b THEN PRINT a ," is less than ", b
|
||||
IF a = b THEN PRINT a, " is equal to ", b
|
||||
IF a > b THEN PRINT a, " is greater than ", b
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
10 INPUT "ENTER TWO INTEGERS: "; A%, B%
|
||||
20 A$(0) = "NOT "
|
||||
30 PRINT A% " IS " A$(A% < B%) "LESS THAN " B%
|
||||
40 PRINT A% " IS " A$(A% = B%) "EQUAL TO " B%
|
||||
50 PRINT A% " IS " A$(A% > B%) "GREATER THAN " B%
|
||||
CLS
|
||||
INPUT "a, b"; a, b 'remember to type the comma when you give the numbers
|
||||
PRINT "a is ";
|
||||
IF a < b THEN PRINT "less than ";
|
||||
IF a = b THEN PRINT "equal to ";
|
||||
IF a > b THEN PRINT "greater than ";
|
||||
PRINT "b"
|
||||
|
|
|
|||
5
Task/Integer-comparison/BASIC/integer-comparison-3.basic
Normal file
5
Task/Integer-comparison/BASIC/integer-comparison-3.basic
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
10 INPUT "ENTER TWO INTEGERS: "; A%, B%
|
||||
20 A$(0) = "NOT "
|
||||
30 PRINT A% " IS " A$(A% < B%) "LESS THAN " B%
|
||||
40 PRINT A% " IS " A$(A% = B%) "EQUAL TO " B%
|
||||
50 PRINT A% " IS " A$(A% > B%) "GREATER THAN " B%
|
||||
6
Task/Integer-comparison/Bc/integer-comparison.bc
Normal file
6
Task/Integer-comparison/Bc/integer-comparison.bc
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
a = read()
|
||||
b = read()
|
||||
if (a < b) print "a is smaller than b\n"
|
||||
if (a > b) print "a is greater than b\n"
|
||||
if (a == b) print "a is equal to b\n"
|
||||
quit
|
||||
|
|
@ -1,17 +1,16 @@
|
|||
#import system.
|
||||
#import extensions.
|
||||
import extensions.
|
||||
|
||||
#symbol program =
|
||||
program =
|
||||
[
|
||||
#var a := console readLine toInt.
|
||||
#var b := console readLine toInt.
|
||||
var a := console readLine; toInt.
|
||||
var b := console readLine; toInt.
|
||||
|
||||
(a < b)
|
||||
? [ console writeLine:a:" is less than ":b. ].
|
||||
if (a < b)
|
||||
[ console printLine(a," is less than ",b) ].
|
||||
|
||||
(a == b)
|
||||
? [ console writeLine:a:" equals ":b. ].
|
||||
if (a == b)
|
||||
[ console printLine(a," equals ",b) ].
|
||||
|
||||
(a > b)
|
||||
? [ console writeLine:a:" is greater than ":b. ].
|
||||
if (a > b)
|
||||
[ console printLine(a," is greater than ",b) ].
|
||||
].
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
read a
|
||||
read b
|
||||
|
||||
if test $a -gt $b
|
||||
echo Greater
|
||||
else if test $a -lt $b
|
||||
echo Less
|
||||
else if test $a -eq $b
|
||||
echo Equal
|
||||
end
|
||||
12
Task/Integer-comparison/Gambas/integer-comparison.gambas
Normal file
12
Task/Integer-comparison/Gambas/integer-comparison.gambas
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
Public Sub Form_Open()
|
||||
Dim sIn As String = InputBox("Enter 2 integers seperated by a comma")
|
||||
Dim iFirst, iSecond As Integer
|
||||
|
||||
iFirst = Val(Split(sIn)[0])
|
||||
iSecond = Val(Split(sIn)[1])
|
||||
|
||||
If iFirst < iSecond Then Print iFirst & " is smaller than " & iSecond & gb.NewLine
|
||||
If iFirst > iSecond Then Print iFirst & " is greater than " & iSecond & gb.NewLine
|
||||
If iFirst = iSecond Then Print iFirst & " is equal to " & iSecond
|
||||
|
||||
End
|
||||
6
Task/Integer-comparison/Hy/integer-comparison.hy
Normal file
6
Task/Integer-comparison/Hy/integer-comparison.hy
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
(def a (int (input "Enter value of a: ")))
|
||||
(def b (int (input "Enter value of b: ")))
|
||||
|
||||
(print (cond [(< a b) "a is less than b"]
|
||||
[(> a b) "a is greater than b"]
|
||||
[(= a b) "a is equal to b"]))
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
function compare()
|
||||
int1 = chomp(readline(STDIN))
|
||||
int2 = chomp(readline(STDIN))
|
||||
int1 = readline(STDIN)
|
||||
int2 = readline(STDIN)
|
||||
print(int1, " is ",
|
||||
int1 < int2 ? "less than " :
|
||||
int1 == int2 ? "equal to " :
|
||||
|
|
|
|||
|
|
@ -1,10 +1,5 @@
|
|||
let my_compare a b =
|
||||
if a < b then "A is less than B"
|
||||
else if a > b then "A is greater than B"
|
||||
else if a = b then "A equals B"
|
||||
else "cannot compare NANs"
|
||||
|
||||
let () =
|
||||
let a = read_int ()
|
||||
and b = read_int () in
|
||||
print_endline (my_compare a b)
|
||||
# let max a b =
|
||||
if a!= b then
|
||||
if a>b then Printf.printf "%d is greater than %d" a b else Printf.printf "%d is less than %d" a b
|
||||
else
|
||||
print_string "numbers are equal" ;;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*REXX program prompts for two integers, compares them, and displays the results.*/
|
||||
numeric digits 1000 /*for the users that really go ka─razy.*/
|
||||
numeric digits 2000 /*for the users that really go ka─razy.*/
|
||||
@=copies('─', 20) /*eyeball catcher for the user's eyen. */
|
||||
a=getInt(@ 'Please enter your 1st integer:') /*obtain the 1st integer from the user.*/
|
||||
b=getInt(@ 'Please enter your 2nd integer:') /* " " 2nd " " " " */
|
||||
|
|
@ -9,15 +9,14 @@ say
|
|||
if a>b then say @ a ' is greater than ' b
|
||||
exit /*stick a fork in it, we're all done. */
|
||||
/*──────────────────────────────────────────────────────────────────────────────────────*/
|
||||
getInt: do forever; say /*keep prompting the user 'til success.*/
|
||||
getInt: do forever; say /*keep prompting the user until success*/
|
||||
say arg(1) /*display the prompt message to console*/
|
||||
parse pull x /*obtain X, and keep its case intact.*/
|
||||
select
|
||||
when x='' then call serr "No argument was entered."
|
||||
when words(x)>1 then call serr 'Too many arguments entered.'
|
||||
when \datatype(x,'N') then call serr "Argument isn't numeric:" x
|
||||
when \datatype(x,'W') then call serr "Argument isn't an integer:" x
|
||||
|
||||
when x='' then call serr "No argument was entered."
|
||||
when words(x)>1 then call serr 'Too many arguments entered.' x
|
||||
when \datatype(x, 'N') then call serr "Argument isn't numeric:" x
|
||||
when \datatype(x, 'W') then call serr "Argument isn't an integer:" x
|
||||
otherwise return x /* [↑] Eureka! Return # to invoker. */
|
||||
end /*select*/
|
||||
end /*forever*/
|
||||
|
|
|
|||
21
Task/Integer-comparison/SQL/integer-comparison.sql
Normal file
21
Task/Integer-comparison/SQL/integer-comparison.sql
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
drop table test;
|
||||
|
||||
create table test(a integer, b integer);
|
||||
|
||||
insert into test values (1,2);
|
||||
|
||||
insert into test values (2,2);
|
||||
|
||||
insert into test values (2,1);
|
||||
|
||||
select to_char(a)||' is less than '||to_char(b) less_than
|
||||
from test
|
||||
where a < b;
|
||||
|
||||
select to_char(a)||' is equal to '||to_char(b) equal_to
|
||||
from test
|
||||
where a = b;
|
||||
|
||||
select to_char(a)||' is greater than '||to_char(b) greater_than
|
||||
from test
|
||||
where a > b;
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
10 INPUT "Enter two integers: ";a;" ";b
|
||||
20 PRINT a;" is ";("less than " AND (a<b));("equal to " AND (a=b));("greather than " AND (a>b));b
|
||||
2
Task/Integer-comparison/Zkl/integer-comparison.zkl
Normal file
2
Task/Integer-comparison/Zkl/integer-comparison.zkl
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
var x,y; x,y=ask("Two ints: ").split(" ").apply("toInt")
|
||||
(if (x==y) "equal" else if (x<y) "less" else if(x>y) "greater").println()
|
||||
Loading…
Add table
Add a link
Reference in a new issue