Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
15
Task/Even-or-odd/Ada/even-or-odd.adb
Normal file
15
Task/Even-or-odd/Ada/even-or-odd.adb
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
-- Ada has bitwise operators in package Interfaces,
|
||||
-- but they work with Interfaces.Unsigned_*** types only.
|
||||
-- Use rem or mod for Integer types, and let the compiler
|
||||
-- optimize it.
|
||||
declare
|
||||
N : Integer := 5;
|
||||
begin
|
||||
if N rem 2 = 0 then
|
||||
Put_Line ("Even number");
|
||||
elseif N rem 2 /= 0 then
|
||||
Put_Line ("Odd number");
|
||||
else
|
||||
Put_Line ("Something went really wrong!");
|
||||
end if;
|
||||
end;
|
||||
13
Task/Even-or-odd/Ballerina/even-or-odd.ballerina
Normal file
13
Task/Even-or-odd/Ballerina/even-or-odd.ballerina
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import ballerina/io;
|
||||
|
||||
function isEven(int n) returns boolean {
|
||||
return n % 2 == 0;
|
||||
}
|
||||
|
||||
public function main() {
|
||||
int i = -3;
|
||||
io:println(`isEven(${i}): ${isEven(i)}`);
|
||||
foreach int t in -2...4 {
|
||||
io:println(`isEven(${t}): ${isEven(t)}`);
|
||||
}
|
||||
}
|
||||
5
Task/Even-or-odd/COBOL/even-or-odd.cob
Normal file
5
Task/Even-or-odd/COBOL/even-or-odd.cob
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
IF FUNCTION REM(Num, 2) = 0
|
||||
DISPLAY Num " is even."
|
||||
ELSE
|
||||
DISPLAY Num " is odd."
|
||||
END-IF
|
||||
10
Task/Even-or-odd/Emacs-Lisp/even-or-odd.el
Normal file
10
Task/Even-or-odd/Emacs-Lisp/even-or-odd.el
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
(require 'cl-lib)
|
||||
|
||||
(defun even-or-odd-p (n)
|
||||
(if (cl-evenp n) 'even 'odd))
|
||||
|
||||
(defun even-or-odd-p (n)
|
||||
(if (zerop (% n 2)) 'even 'odd))
|
||||
|
||||
(message "%d is %s" 3 (even-or-oddp 3))
|
||||
(message "%d is %s" 2 (even-or-oddp 2))
|
||||
5
Task/Even-or-odd/Euphoria/even-or-odd.eu
Normal file
5
Task/Even-or-odd/Euphoria/even-or-odd.eu
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
include std/math.e
|
||||
|
||||
for i = 1 to 10 do
|
||||
? {i, is_even(i)}
|
||||
end for
|
||||
15
Task/Even-or-odd/Gleam/even-or-odd.gleam
Normal file
15
Task/Even-or-odd/Gleam/even-or-odd.gleam
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import gleam/bool
|
||||
import gleam/int
|
||||
import gleam/io
|
||||
|
||||
pub fn main() {
|
||||
1
|
||||
|> int.is_odd
|
||||
|> bool.to_string
|
||||
|> io.println
|
||||
|
||||
2
|
||||
|> int.is_even
|
||||
|> bool.to_string
|
||||
|> io.println
|
||||
}
|
||||
2
Task/Even-or-odd/PowerShell/even-or-odd-1.ps1
Normal file
2
Task/Even-or-odd/PowerShell/even-or-odd-1.ps1
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
$IsOdd = -not ( [bigint]$N ).IsEven
|
||||
$IsEven = ( [bigint]$N ).IsEven
|
||||
2
Task/Even-or-odd/PowerShell/even-or-odd-2.ps1
Normal file
2
Task/Even-or-odd/PowerShell/even-or-odd-2.ps1
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
$IsOdd = [boolean]( $N -band 1 )
|
||||
$IsEven = [boolean]( $N -band 0 )
|
||||
2
Task/Even-or-odd/PowerShell/even-or-odd-3.ps1
Normal file
2
Task/Even-or-odd/PowerShell/even-or-odd-3.ps1
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
$IsOdd = $N % 2 -ne 0
|
||||
$IsEven = $N % 2 -eq 0
|
||||
3
Task/Even-or-odd/ReScript/even-or-odd.res
Normal file
3
Task/Even-or-odd/ReScript/even-or-odd.res
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
let is_even = d => mod(d, 2) == 0
|
||||
|
||||
let is_odd = d => mod(d, 2) != 0
|
||||
2
Task/Even-or-odd/Rye/even-or-odd.rye
Normal file
2
Task/Even-or-odd/Rye/even-or-odd.rye
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
print is-even 2
|
||||
print is-odd 2
|
||||
12
Task/Even-or-odd/VBScript/even-or-odd.vbs
Normal file
12
Task/Even-or-odd/VBScript/even-or-odd.vbs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
Function odd_or_even(n)
|
||||
If n Mod 2 = 0 Then
|
||||
odd_or_even = "Even"
|
||||
Else
|
||||
odd_or_even = "Odd"
|
||||
End If
|
||||
End Function
|
||||
|
||||
WScript.StdOut.Write "Please enter a number: "
|
||||
n = WScript.StdIn.ReadLine
|
||||
WScript.StdOut.Write n & " is " & odd_or_even(CInt(n))
|
||||
WScript.StdOut.WriteLine
|
||||
Loading…
Add table
Add a link
Reference in a new issue