WeixiangYan/CodeTransOcean huggingface dataset:
Task: Ackermann function







Python: from __future__ import print_function

def setup():
    for m in range(4):
        for n in range(7):
            print("{} ".format(ackermann(m, n)), end = "")
        print()
    

def ackermann(m, n):
    if m == 0:
        return n + 1
    elif m > 0 and n == 0:
        return ackermann(m - 1, 1)
    else:
        return ackermann(m - 1, ackermann(m, n - 1))



COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. Ackermann.

       DATA DIVISION.
       LINKAGE SECTION.
       01  M          USAGE UNSIGNED-LONG.
       01  N          USAGE UNSIGNED-LONG.

       01  Return-Val USAGE UNSIGNED-LONG.

       PROCEDURE DIVISION USING M N Return-Val.
           EVALUATE M ALSO N
               WHEN 0 ALSO ANY
                   ADD 1 TO N GIVING Return-Val

               WHEN NOT 0 ALSO 0
                   SUBTRACT 1 FROM M
                   CALL "Ackermann" USING BY CONTENT M BY CONTENT 1
                       BY REFERENCE Return-Val

               WHEN NOT 0 ALSO NOT 0
                   SUBTRACT 1 FROM N
                   CALL "Ackermann" USING BY CONTENT M BY CONTENT N
                       BY REFERENCE Return-Val
                       
                   SUBTRACT 1 FROM M
                   CALL "Ackermann" USING BY CONTENT M
                       BY CONTENT Return-Val BY REFERENCE Return-Val
           END-EVALUATE

           GOBACK
           .
Task: Ackermann function








VB: Private Function Ackermann_function(m As Variant, n As Variant) As Variant
    Dim result As Variant
    Debug.Assert m >= 0
    Debug.Assert n >= 0
    If m = 0 Then
        result = CDec(n + 1)
    Else
        If n = 0 Then
            result = Ackermann_function(m - 1, 1)
        Else
            result = Ackermann_function(m - 1, Ackermann_function(m, n - 1))
        End If
    End If
    Ackermann_function = CDec(result)
End Function
Public Sub main()
    Debug.Print "           n=",
    For j = 0 To 7
        Debug.Print j,
    Next j
    Debug.Print
    For i = 0 To 3
        Debug.Print "m=" & i,
        For j = 0 To 7
            Debug.Print Ackermann_function(i, j),
        Next j
        Debug.Print
    Next i
End Sub


COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. Ackermann.

       DATA DIVISION.
       LINKAGE SECTION.
       01  M          USAGE UNSIGNED-LONG.
       01  N          USAGE UNSIGNED-LONG.

       01  Return-Val USAGE UNSIGNED-LONG.

       PROCEDURE DIVISION USING M N Return-Val.
           EVALUATE M ALSO N
               WHEN 0 ALSO ANY
                   ADD 1 TO N GIVING Return-Val

               WHEN NOT 0 ALSO 0
                   SUBTRACT 1 FROM M
                   CALL "Ackermann" USING BY CONTENT M BY CONTENT 1
                       BY REFERENCE Return-Val

               WHEN NOT 0 ALSO NOT 0
                   SUBTRACT 1 FROM N
                   CALL "Ackermann" USING BY CONTENT M BY CONTENT N
                       BY REFERENCE Return-Val
                       
                   SUBTRACT 1 FROM M
                   CALL "Ackermann" USING BY CONTENT M
                       BY CONTENT Return-Val BY REFERENCE Return-Val
           END-EVALUATE

           GOBACK
           .
Task: Ackermann function




Go: func Ackermann(m, n uint) uint {
	switch 0 {
	case m:
		return n + 1
	case n:
		return Ackermann(m - 1, 1)
	}
	return Ackermann(m - 1, Ackermann(m, n - 1))
}






COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. Ackermann.

       DATA DIVISION.
       LINKAGE SECTION.
       01  M          USAGE UNSIGNED-LONG.
       01  N          USAGE UNSIGNED-LONG.

       01  Return-Val USAGE UNSIGNED-LONG.

       PROCEDURE DIVISION USING M N Return-Val.
           EVALUATE M ALSO N
               WHEN 0 ALSO ANY
                   ADD 1 TO N GIVING Return-Val

               WHEN NOT 0 ALSO 0
                   SUBTRACT 1 FROM M
                   CALL "Ackermann" USING BY CONTENT M BY CONTENT 1
                       BY REFERENCE Return-Val

               WHEN NOT 0 ALSO NOT 0
                   SUBTRACT 1 FROM N
                   CALL "Ackermann" USING BY CONTENT M BY CONTENT N
                       BY REFERENCE Return-Val
                       
                   SUBTRACT 1 FROM M
                   CALL "Ackermann" USING BY CONTENT M
                       BY CONTENT Return-Val BY REFERENCE Return-Val
           END-EVALUATE

           GOBACK
           .
Task: Ackermann function






PHP: function ackermann( $m , $n )
{
    if ( $m==0 )
    {
        return $n + 1;
    }
    elseif ( $n==0 )
    {
        return ackermann( $m-1 , 1 );
    }
    return ackermann( $m-1, ackermann( $m , $n-1 ) );
}

echo ackermann( 3, 4 );
Task: Ackermann function






PHP: function ackermann( $m , $n )
{
    if ( $m==0 )
    {
        return $n + 1;
    }
    elseif ( $n==0 )
    {
        return ackermann( $m-1 , 1 );
    }
    return ackermann( $m-1, ackermann( $m , $n-1 ) );
}

echo ackermann( 3, 4 );







Ada: with Ada.Text_IO;  use Ada.Text_IO;

procedure Test_Ackermann is
   function Ackermann (M, N : Natural) return Natural is
   begin
      if M = 0 then
         return N + 1;
      elsif N = 0 then
         return Ackermann (M - 1, 1);
      else
         return Ackermann (M - 1, Ackermann (M, N - 1));
      end if;
   end Ackermann;
begin
   for M in 0..3 loop
      for N in 0..6 loop
         Put (Natural'Image (Ackermann (M, N)));
      end loop;
      New_Line;
   end loop;
end Test_Ackermann;
Task: Ackermann function






PHP: function ackermann( $m , $n )
{
    if ( $m==0 )
    {
        return $n + 1;
    }
    elseif ( $n==0 )
    {
        return ackermann( $m-1 , 1 );
    }
    return ackermann( $m-1, ackermann( $m , $n-1 ) );
}

echo ackermann( 3, 4 );





COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. Ackermann.

       DATA DIVISION.
       LINKAGE SECTION.
       01  M          USAGE UNSIGNED-LONG.
       01  N          USAGE UNSIGNED-LONG.

       01  Return-Val USAGE UNSIGNED-LONG.

       PROCEDURE DIVISION USING M N Return-Val.
           EVALUATE M ALSO N
               WHEN 0 ALSO ANY
                   ADD 1 TO N GIVING Return-Val

               WHEN NOT 0 ALSO 0
                   SUBTRACT 1 FROM M
                   CALL "Ackermann" USING BY CONTENT M BY CONTENT 1
                       BY REFERENCE Return-Val

               WHEN NOT 0 ALSO NOT 0
                   SUBTRACT 1 FROM N
                   CALL "Ackermann" USING BY CONTENT M BY CONTENT N
                       BY REFERENCE Return-Val
                       
                   SUBTRACT 1 FROM M
                   CALL "Ackermann" USING BY CONTENT M
                       BY CONTENT Return-Val BY REFERENCE Return-Val
           END-EVALUATE

           GOBACK
           .
Task: Enumerations



C#: enum fruits { apple, banana, cherry }

enum fruits { apple = 0, banana = 1, cherry = 2 }

enum fruits : int { apple = 0, banana = 1, cherry = 2 }

[FlagsAttribute]
enum Colors { Red = 1, Green = 2, Blue = 4, Yellow = 8 }









Ada: type Fruit is (apple, banana, cherry); 
for Fruit use (apple => 1, banana => 2, cherry => 4);
Task: Enumerations

C: enum fruits { apple, banana, cherry };

enum fruits { apple = 0, banana = 1, cherry = 2 };











Ada: type Fruit is (apple, banana, cherry); 
for Fruit use (apple => 1, banana => 2, cherry => 4);
Task: Enumerations


C++: enum fruits { apple, banana, cherry };

enum fruits { apple = 0, banana = 1, cherry = 2 };










Ada: type Fruit is (apple, banana, cherry); 
for Fruit use (apple => 1, banana => 2, cherry => 4);
Task: Enumerations




Go: const (
	apple = iota
	banana
	cherry
)








Ada: type Fruit is (apple, banana, cherry); 
for Fruit use (apple => 1, banana => 2, cherry => 4);
Task: Enumerations





Java: enum Fruits{
   APPLE, BANANA, CHERRY
}







Ada: type Fruit is (apple, banana, cherry); 
for Fruit use (apple => 1, banana => 2, cherry => 4);
Task: Enumerations







Python: >>> from enum import Enum
>>> Contact = Enum('Contact', 'FIRST_NAME, LAST_NAME, PHONE')
>>> Contact.__members__
mappingproxy(OrderedDict([('FIRST_NAME', <Contact.FIRST_NAME: 1>), ('LAST_NAME', <Contact.LAST_NAME: 2>), ('PHONE', <Contact.PHONE: 3>)]))
>>> 
>>> 
>>> class Contact2(Enum):
	FIRST_NAME = 1
	LAST_NAME = 2
	PHONE = 3

	
>>> Contact2.__members__
mappingproxy(OrderedDict([('FIRST_NAME', <Contact2.FIRST_NAME: 1>), ('LAST_NAME', <Contact2.LAST_NAME: 2>), ('PHONE', <Contact2.PHONE: 3>)]))
>>>





Ada: type Fruit is (apple, banana, cherry); 
for Fruit use (apple => 1, banana => 2, cherry => 4);
Task: Enumerations








VB: 
Enum fruits
  apple
  banana
  cherry
End Enum
 

Enum fruits2
  pear = 5
  mango = 10
  kiwi = 20
  pineapple = 20
End Enum


Sub test()
Dim f As fruits
  f = apple
  Debug.Print "apple equals "; f
  Debug.Print "kiwi equals "; kiwi
  Debug.Print "cherry plus kiwi plus pineapple equals "; cherry + kiwi + pineapple
End Sub




Ada: type Fruit is (apple, banana, cherry); 
for Fruit use (apple => 1, banana => 2, cherry => 4);
Task: Enumerations

C: enum fruits { apple, banana, cherry };

enum fruits { apple = 0, banana = 1, cherry = 2 };
Task: Enumerations



C#: enum fruits { apple, banana, cherry }

enum fruits { apple = 0, banana = 1, cherry = 2 }

enum fruits : int { apple = 0, banana = 1, cherry = 2 }

[FlagsAttribute]
enum Colors { Red = 1, Green = 2, Blue = 4, Yellow = 8 }
Task: Enumerations


C++: enum fruits { apple, banana, cherry };

enum fruits { apple = 0, banana = 1, cherry = 2 };
Task: Enumerations





Java: enum Fruits{
   APPLE, BANANA, CHERRY
}
Task: Enumerations







Python: >>> from enum import Enum
>>> Contact = Enum('Contact', 'FIRST_NAME, LAST_NAME, PHONE')
>>> Contact.__members__
mappingproxy(OrderedDict([('FIRST_NAME', <Contact.FIRST_NAME: 1>), ('LAST_NAME', <Contact.LAST_NAME: 2>), ('PHONE', <Contact.PHONE: 3>)]))
>>> 
>>> 
>>> class Contact2(Enum):
	FIRST_NAME = 1
	LAST_NAME = 2
	PHONE = 3

	
>>> Contact2.__members__
mappingproxy(OrderedDict([('FIRST_NAME', <Contact2.FIRST_NAME: 1>), ('LAST_NAME', <Contact2.LAST_NAME: 2>), ('PHONE', <Contact2.PHONE: 3>)]))
>>>
Task: Enumerations








VB: 
Enum fruits
  apple
  banana
  cherry
End Enum
 

Enum fruits2
  pear = 5
  mango = 10
  kiwi = 20
  pineapple = 20
End Enum


Sub test()
Dim f As fruits
  f = apple
  Debug.Print "apple equals "; f
  Debug.Print "kiwi equals "; kiwi
  Debug.Print "cherry plus kiwi plus pineapple equals "; cherry + kiwi + pineapple
End Sub
Task: Enumerations




Go: const (
	apple = iota
	banana
	cherry
)
Task: Enumerations



C#: enum fruits { apple, banana, cherry }

enum fruits { apple = 0, banana = 1, cherry = 2 }

enum fruits : int { apple = 0, banana = 1, cherry = 2 }

[FlagsAttribute]
enum Colors { Red = 1, Green = 2, Blue = 4, Yellow = 8 }








Fortran: enum, bind(c)
  enumerator :: one=1, two, three, four, five
  enumerator :: six, seven, nine=9
end enum
Task: Enumerations


C++: enum fruits { apple, banana, cherry };

enum fruits { apple = 0, banana = 1, cherry = 2 };









Fortran: enum, bind(c)
  enumerator :: one=1, two, three, four, five
  enumerator :: six, seven, nine=9
end enum
Task: Enumerations

C: enum fruits { apple, banana, cherry };

enum fruits { apple = 0, banana = 1, cherry = 2 };










Fortran: enum, bind(c)
  enumerator :: one=1, two, three, four, five
  enumerator :: six, seven, nine=9
end enum
Task: Enumerations





Java: enum Fruits{
   APPLE, BANANA, CHERRY
}






Fortran: enum, bind(c)
  enumerator :: one=1, two, three, four, five
  enumerator :: six, seven, nine=9
end enum
Task: Enumerations







Python: >>> from enum import Enum
>>> Contact = Enum('Contact', 'FIRST_NAME, LAST_NAME, PHONE')
>>> Contact.__members__
mappingproxy(OrderedDict([('FIRST_NAME', <Contact.FIRST_NAME: 1>), ('LAST_NAME', <Contact.LAST_NAME: 2>), ('PHONE', <Contact.PHONE: 3>)]))
>>> 
>>> 
>>> class Contact2(Enum):
	FIRST_NAME = 1
	LAST_NAME = 2
	PHONE = 3

	
>>> Contact2.__members__
mappingproxy(OrderedDict([('FIRST_NAME', <Contact2.FIRST_NAME: 1>), ('LAST_NAME', <Contact2.LAST_NAME: 2>), ('PHONE', <Contact2.PHONE: 3>)]))
>>>




Fortran: enum, bind(c)
  enumerator :: one=1, two, three, four, five
  enumerator :: six, seven, nine=9
end enum
Task: Enumerations








VB: 
Enum fruits
  apple
  banana
  cherry
End Enum
 

Enum fruits2
  pear = 5
  mango = 10
  kiwi = 20
  pineapple = 20
End Enum


Sub test()
Dim f As fruits
  f = apple
  Debug.Print "apple equals "; f
  Debug.Print "kiwi equals "; kiwi
  Debug.Print "cherry plus kiwi plus pineapple equals "; cherry + kiwi + pineapple
End Sub



Fortran: enum, bind(c)
  enumerator :: one=1, two, three, four, five
  enumerator :: six, seven, nine=9
end enum
Task: Enumerations






PHP: 
$fruits = array( "apple", "banana", "cherry" );
$fruits = array( "apple" => 0, "banana" => 1, "cherry" => 2 );

class Fruit {
  const APPLE = 0;
  const BANANA = 1;
  const CHERRY = 2;
}

$value = Fruit::APPLE;

define("FRUIT_APPLE", 0);
define("FRUIT_BANANA", 1);
define("FRUIT_CHERRY", 2);





Fortran: enum, bind(c)
  enumerator :: one=1, two, three, four, five
  enumerator :: six, seven, nine=9
end enum
Task: Enumerations






PHP: 
$fruits = array( "apple", "banana", "cherry" );
$fruits = array( "apple" => 0, "banana" => 1, "cherry" => 2 );

class Fruit {
  const APPLE = 0;
  const BANANA = 1;
  const CHERRY = 2;
}

$value = Fruit::APPLE;

define("FRUIT_APPLE", 0);
define("FRUIT_BANANA", 1);
define("FRUIT_CHERRY", 2);
Task: Enumerations






PHP: 
$fruits = array( "apple", "banana", "cherry" );
$fruits = array( "apple" => 0, "banana" => 1, "cherry" => 2 );

class Fruit {
  const APPLE = 0;
  const BANANA = 1;
  const CHERRY = 2;
}

$value = Fruit::APPLE;

define("FRUIT_APPLE", 0);
define("FRUIT_BANANA", 1);
define("FRUIT_CHERRY", 2);






Ada: type Fruit is (apple, banana, cherry); 
for Fruit use (apple => 1, banana => 2, cherry => 4);
Task: Catalan numbers_Pascal's triangle



C#: int n = 15;
List<int> t = new List<int>() { 0, 1 };
for (int i = 1; i <= n; i++)
{
    for (var j = i; j > 1; j--) t[j] += t[j - 1];
    t.Add(t[i]);
    for (var j = i + 1; j > 1; j--) t[j] += t[j - 1];
    Console.Write(((i == 1) ? "" : ", ") + (t[i + 1] - t[i]));
}









Ada: with Ada.Text_IO, Pascal;

procedure Catalan is
   
   Last: Positive := 15;   
   Row: Pascal.Row := Pascal.First_Row(2*Last+1);
   
begin
   for I in 1 .. Last loop
      Row := Pascal.Next_Row(Row);
      Row := Pascal.Next_Row(Row);
      Ada.Text_IO.Put(Integer'Image(Row(I+1)-Row(I+2)));
   end loop;
end Catalan;
Task: Catalan numbers_Pascal's triangle

C: 





#include <stdio.h>
#include <stdlib.h>


const int N = 15;

int main()
{
    
    register int k, n;

    
    unsigned long long int num, den;

    
    int catalan;

    
    printf("1 ");

    
    for (n=2; n<=N; ++n) {
        
        num = den = 1;
        
        for (k=2; k<=n; ++k) {
            num *= (n+k);
            den *= k;
            catalan = num /den;
        }
        
        
        printf("%d ", catalan);
    }

    
    printf("\n");
    return 0;
}











Ada: with Ada.Text_IO, Pascal;

procedure Catalan is
   
   Last: Positive := 15;   
   Row: Pascal.Row := Pascal.First_Row(2*Last+1);
   
begin
   for I in 1 .. Last loop
      Row := Pascal.Next_Row(Row);
      Row := Pascal.Next_Row(Row);
      Ada.Text_IO.Put(Integer'Image(Row(I+1)-Row(I+2)));
   end loop;
end Catalan;
Task: Catalan numbers_Pascal's triangle


C++: 



#include <iostream>
int main() {
  const int N = 15;
  int t[N+2] = {0,1};
  for(int i = 1; i<=N; i++){
    for(int j = i; j>1; j--) t[j] = t[j] + t[j-1];
    t[i+1] = t[i];
    for(int j = i+1; j>1; j--) t[j] = t[j] + t[j-1];
    std::cout << t[i+1] - t[i] << " ";
  }
  return 0;
}










Ada: with Ada.Text_IO, Pascal;

procedure Catalan is
   
   Last: Positive := 15;   
   Row: Pascal.Row := Pascal.First_Row(2*Last+1);
   
begin
   for I in 1 .. Last loop
      Row := Pascal.Next_Row(Row);
      Row := Pascal.Next_Row(Row);
      Ada.Text_IO.Put(Integer'Image(Row(I+1)-Row(I+2)));
   end loop;
end Catalan;
Task: Catalan numbers_Pascal's triangle




Go: package main

import "fmt"

func main() {
    const n = 15
    t := [n + 2]uint64{0, 1}
    for i := 1; i <= n; i++ {
        for j := i; j > 1; j-- {
            t[j] += t[j-1]
        }
        t[i+1] = t[i]
        for j := i + 1; j > 1; j-- {
            t[j] += t[j-1]
        }
        fmt.Printf("%2d : %d\n", i, t[i+1]-t[i])
    }
}








Ada: with Ada.Text_IO, Pascal;

procedure Catalan is
   
   Last: Positive := 15;   
   Row: Pascal.Row := Pascal.First_Row(2*Last+1);
   
begin
   for I in 1 .. Last loop
      Row := Pascal.Next_Row(Row);
      Row := Pascal.Next_Row(Row);
      Ada.Text_IO.Put(Integer'Image(Row(I+1)-Row(I+2)));
   end loop;
end Catalan;
Task: Catalan numbers_Pascal's triangle





Java: public class Test {
    public static void main(String[] args) {
        int N = 15;
        int[] t = new int[N + 2];
        t[1] = 1;

        for (int i = 1; i <= N; i++) {

            for (int j = i; j > 1; j--)
                t[j] = t[j] + t[j - 1];

            t[i + 1] = t[i];

            for (int j = i + 1; j > 1; j--)
                t[j] = t[j] + t[j - 1];

            System.out.printf("%d ", t[i + 1] - t[i]);
        }
    }
}







Ada: with Ada.Text_IO, Pascal;

procedure Catalan is
   
   Last: Positive := 15;   
   Row: Pascal.Row := Pascal.First_Row(2*Last+1);
   
begin
   for I in 1 .. Last loop
      Row := Pascal.Next_Row(Row);
      Row := Pascal.Next_Row(Row);
      Ada.Text_IO.Put(Integer'Image(Row(I+1)-Row(I+2)));
   end loop;
end Catalan;
Task: Catalan numbers_Pascal's triangle







Python: >>> n = 15
>>> t = [0] * (n + 2)
>>> t[1] = 1
>>> for i in range(1, n + 1):
	for j in range(i, 1, -1): t[j] += t[j - 1]
	t[i + 1] = t[i]
	for j in range(i + 1, 1, -1): t[j] += t[j - 1]
	print(t[i+1] - t[i], end=' ')

	
1 2 5 14 42 132 429 1430 4862 16796 58786 208012 742900 2674440 9694845 
>>>





Ada: with Ada.Text_IO, Pascal;

procedure Catalan is
   
   Last: Positive := 15;   
   Row: Pascal.Row := Pascal.First_Row(2*Last+1);
   
begin
   for I in 1 .. Last loop
      Row := Pascal.Next_Row(Row);
      Row := Pascal.Next_Row(Row);
      Ada.Text_IO.Put(Integer'Image(Row(I+1)-Row(I+2)));
   end loop;
end Catalan;
Task: Catalan numbers_Pascal's triangle








VB: Sub catalan()
    Const n = 15
    Dim t(n + 2) As Long
    Dim i  As Integer, j As Integer
    t(1) = 1
    For i = 1 To n
        For j = i + 1 To 2 Step -1
            t(j) = t(j) + t(j - 1)
        Next j
        t(i + 1) = t(i)
        For j = i + 2 To 2 Step -1
            t(j) = t(j) + t(j - 1)
        Next j
        Debug.Print i, t(i + 1) - t(i)
    Next i
End Sub 




Ada: with Ada.Text_IO, Pascal;

procedure Catalan is
   
   Last: Positive := 15;   
   Row: Pascal.Row := Pascal.First_Row(2*Last+1);
   
begin
   for I in 1 .. Last loop
      Row := Pascal.Next_Row(Row);
      Row := Pascal.Next_Row(Row);
      Ada.Text_IO.Put(Integer'Image(Row(I+1)-Row(I+2)));
   end loop;
end Catalan;
Task: Catalan numbers_Pascal's triangle

C: 





#include <stdio.h>
#include <stdlib.h>


const int N = 15;

int main()
{
    
    register int k, n;

    
    unsigned long long int num, den;

    
    int catalan;

    
    printf("1 ");

    
    for (n=2; n<=N; ++n) {
        
        num = den = 1;
        
        for (k=2; k<=n; ++k) {
            num *= (n+k);
            den *= k;
            catalan = num /den;
        }
        
        
        printf("%d ", catalan);
    }

    
    printf("\n");
    return 0;
}
Task: Catalan numbers_Pascal's triangle



C#: int n = 15;
List<int> t = new List<int>() { 0, 1 };
for (int i = 1; i <= n; i++)
{
    for (var j = i; j > 1; j--) t[j] += t[j - 1];
    t.Add(t[i]);
    for (var j = i + 1; j > 1; j--) t[j] += t[j - 1];
    Console.Write(((i == 1) ? "" : ", ") + (t[i + 1] - t[i]));
}
Task: Catalan numbers_Pascal's triangle


C++: 



#include <iostream>
int main() {
  const int N = 15;
  int t[N+2] = {0,1};
  for(int i = 1; i<=N; i++){
    for(int j = i; j>1; j--) t[j] = t[j] + t[j-1];
    t[i+1] = t[i];
    for(int j = i+1; j>1; j--) t[j] = t[j] + t[j-1];
    std::cout << t[i+1] - t[i] << " ";
  }
  return 0;
}
Task: Catalan numbers_Pascal's triangle





Java: public class Test {
    public static void main(String[] args) {
        int N = 15;
        int[] t = new int[N + 2];
        t[1] = 1;

        for (int i = 1; i <= N; i++) {

            for (int j = i; j > 1; j--)
                t[j] = t[j] + t[j - 1];

            t[i + 1] = t[i];

            for (int j = i + 1; j > 1; j--)
                t[j] = t[j] + t[j - 1];

            System.out.printf("%d ", t[i + 1] - t[i]);
        }
    }
}
Task: Catalan numbers_Pascal's triangle







Python: >>> n = 15
>>> t = [0] * (n + 2)
>>> t[1] = 1
>>> for i in range(1, n + 1):
	for j in range(i, 1, -1): t[j] += t[j - 1]
	t[i + 1] = t[i]
	for j in range(i + 1, 1, -1): t[j] += t[j - 1]
	print(t[i+1] - t[i], end=' ')

	
1 2 5 14 42 132 429 1430 4862 16796 58786 208012 742900 2674440 9694845 
>>>
Task: Catalan numbers_Pascal's triangle








VB: Sub catalan()
    Const n = 15
    Dim t(n + 2) As Long
    Dim i  As Integer, j As Integer
    t(1) = 1
    For i = 1 To n
        For j = i + 1 To 2 Step -1
            t(j) = t(j) + t(j - 1)
        Next j
        t(i + 1) = t(i)
        For j = i + 2 To 2 Step -1
            t(j) = t(j) + t(j - 1)
        Next j
        Debug.Print i, t(i + 1) - t(i)
    Next i
End Sub
Task: Catalan numbers_Pascal's triangle




Go: package main

import "fmt"

func main() {
    const n = 15
    t := [n + 2]uint64{0, 1}
    for i := 1; i <= n; i++ {
        for j := i; j > 1; j-- {
            t[j] += t[j-1]
        }
        t[i+1] = t[i]
        for j := i + 1; j > 1; j-- {
            t[j] += t[j-1]
        }
        fmt.Printf("%2d : %d\n", i, t[i+1]-t[i])
    }
}
Task: Hello world_Text



C#: Using System;
namespace HelloWorld {
  class Program
  {
    static void Main()
    {
      Console.Writeln("Hello World!");
    }
  }
}









Ada: with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
begin
  Put_Line ("Hello world!");
end Main;
Task: Hello world_Text

C: const hello = "Hello world!\n"

print(hello)











Ada: with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
begin
  Put_Line ("Hello world!");
end Main;
Task: Hello world_Text


C++: #include <iostream>

int main () {
  std::cout << "Hello world!" << std::endl;
}










Ada: with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
begin
  Put_Line ("Hello world!");
end Main;
Task: Hello world_Text




Go: package main

import "fmt"

func main() { fmt.Println("Hello world!") }








Ada: with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
begin
  Put_Line ("Hello world!");
end Main;
Task: Hello world_Text





Java: module HelloWorld
    {
    void run()
        {
        @Inject Console console;
        console.print("Hello World!");
        }
    }







Ada: with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
begin
  Put_Line ("Hello world!");
end Main;
Task: Hello world_Text







Python: print "Hello world!"





Ada: with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
begin
  Put_Line ("Hello world!");
end Main;
Task: Hello world_Text








VB: Public Sub hello_world_text
    Debug.Print "Hello World!"
End Sub




Ada: with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
begin
  Put_Line ("Hello world!");
end Main;
Task: Hello world_Text



C#: Using System;
namespace HelloWorld {
  class Program
  {
    static void Main()
    {
      Console.Writeln("Hello World!");
    }
  }
}
Task: Hello world_Text


C++: #include <iostream>

int main () {
  std::cout << "Hello world!" << std::endl;
}
Task: Hello world_Text





Java: module HelloWorld
    {
    void run()
        {
        @Inject Console console;
        console.print("Hello World!");
        }
    }
Task: Hello world_Text

C: const hello = "Hello world!\n"

print(hello)
Task: Hello world_Text







Python: print "Hello world!"
Task: Hello world_Text








VB: Public Sub hello_world_text
    Debug.Print "Hello World!"
End Sub
Task: Hello world_Text




Go: package main

import "fmt"

func main() { fmt.Println("Hello world!") }