6. const fs = require('fs'); const compose = (...funcs) => x => funcs.
reduce((x, fn) => fn(x), x); const DENSITY_COL = 3; const renderTab
table => { const cellWidth = [18, 10, 8, 8, 18, 6]; return table.ma
=> (row.map((cell, i) => { const width = cellWidth[i]; return i ? c
Fortran
INTEGER N
N = 1
10 IF (N .LE. 100) THEN
WRITE (*,*) N
N = 2*N
GOTO 10
ENDIF
INTEGER I
DO 20 I = 10, 1, -2
WRITE (*,*) 'I =', i
20 CONTINUE
7. const fs = require('fs'); const compose = (...funcs) => x => funcs.
reduce((x, fn) => fn(x), x); const DENSITY_COL = 3; const renderTab
table => { const cellWidth = [18, 10, 8, 8, 18, 6]; return table.ma
=> (row.map((cell, i) => { const width = cellWidth[i]; return i ? c
Basic
10 LET S = 0
20 MAT INPUT V
30 LET N = NUM
40 IF N = 0 THEN 100
50 FOR I = 1 TO N
65 LET S = S + V(I)
70 NEXT I
80 PRINT S/N
90 GO TO 10
100 END
8. const fs = require('fs'); const compose = (...funcs) => x => funcs.
reduce((x, fn) => fn(x), x); const DENSITY_COL = 3; const renderTab
table => { const cellWidth = [18, 10, 8, 8, 18, 6]; return table.ma
=> (row.map((cell, i) => { const width = cellWidth[i]; return i ? c
LISP
(+ 1 2 3 4)
(defun factorial (n)
(if (= n 0) 1
(* n (factorial (- n 1)))))
(defun factorial (n)
(loop for i from 1 to n
for fac = 1 then (* fac i)
finally (return fac)))
9. const fs = require('fs'); const compose = (...funcs) => x => funcs.
reduce((x, fn) => fn(x), x); const DENSITY_COL = 3; const renderTab
table => { const cellWidth = [18, 10, 8, 8, 18, 6]; return table.ma
=> (row.map((cell, i) => { const width = cellWidth[i]; return i ? c
Algol 60
BEGIN
INTEGER ARRAY candidates[0:1000];
INTEGER i;
FOR i := 0 STEP 1 UNTIL 1000 DO
BEGIN
candidates[i] := 1;
END;
END;
11. const fs = require('fs'); const compose = (...funcs) => x => funcs.
reduce((x, fn) => fn(x), x); const DENSITY_COL = 3; const renderTab
table => { const cellWidth = [18, 10, 8, 8, 18, 6]; return table.ma
=> (row.map((cell, i) => { const width = cellWidth[i]; return i ? c
C++
#include <iostream>
using namespace std;
class Point {
public:
double x, y;
};
int main() {
Point point1;
point1.x = 10.0;
point1.y = 20.0;
cout << point1.x << "," << point1.y << endl;
return 0;
}
12. const fs = require('fs'); const compose = (...funcs) => x => funcs.
reduce((x, fn) => fn(x), x); const DENSITY_COL = 3; const renderTab
table => { const cellWidth = [18, 10, 8, 8, 18, 6]; return table.ma
=> (row.map((cell, i) => { const width = cellWidth[i]; return i ? c
Ada
function Get_Maximum (Of : My_Array_Type) return
Element_Type is
Maximum : Element_Type := Of (Of'First);
begin
for I in Of'First + 1 .. Of'Last loop
if Of (I) > Maximum then
Maximum := Of (I);
end if;
end loop;
return Maximum;
end Get;
13. const fs = require('fs'); const compose = (...funcs) => x => funcs.
reduce((x, fn) => fn(x), x); const DENSITY_COL = 3; const renderTab
table => { const cellWidth = [18, 10, 8, 8, 18, 6]; return table.ma
=> (row.map((cell, i) => { const width = cellWidth[i]; return i ? c
dBase, FoxBase, Clipper
@ 0,0
arr := { 1, 2, 3 }
str := "abc"
FOR EACH a, b IN arr, str
? a, b
a *= 2
IF a == 3
?? Upper( b )
EXIT
ENDIF
NEXT