kazuyamaa/multi-language-messages-01 huggingface dataset:
Task: Sudan function
C#: 

using System;

namespace Sudan
{
  class Sudan
  {
  	static int F(int n,int x,int y) {
  		if (n == 0) {
    		return x + y;
  		}
 
  		else if (y == 0) {
    		return x;
  		}
 
  		return F(n - 1, F(n, x, y - 1), F(n, x, y - 1) + y);
	}
    
    static void Main(string[] args)
    {
      Console.WriteLine("F(1,3,3) = " + F(1,3,3));    
    }
  }
}

Java: 

public class Main {

  private static int F(int n,int x,int y) {
  	if (n == 0) {
    	return x + y;
  	}
 
 	 else if (y == 0) {
    	return x;
  	}
 
  	return F(n - 1, F(n, x, y - 1), F(n, x, y - 1) + y);
 }

  public static void main(String[] args) {
    System.out.println("F(1,3,3) = " + F(1,3,3));
  }
}
Task: Sudan function
C#: 

using System;

namespace Sudan
{
  class Sudan
  {
  	static int F(int n,int x,int y) {
  		if (n == 0) {
    		return x + y;
  		}
 
  		else if (y == 0) {
    		return x;
  		}
 
  		return F(n - 1, F(n, x, y - 1), F(n, x, y - 1) + y);
	}
    
    static void Main(string[] args)
    {
      Console.WriteLine("F(1,3,3) = " + F(1,3,3));    
    }
  }
}

Python: 

def F(n,x,y):
  if n==0:
    return x + y
  elif y==0:
    return x
  else:
    return F(n - 1, F(n, x, y - 1), F(n, x, y - 1) + y)
    
    
print("F(1,3,3) = ", F(1,3,3))
Task: Sudan function
Go: package main

import "fmt"

func F(n, x, y int) int {
    if n == 0 {
        return x + y
    }
    if y == 0 {
        return x
    }
    return F(n-1, F(n, x, y-1), F(n, x, y-1)+y)
}

func main() {
    for n := 0; n < 2; n++ {
        fmt.Printf("Values of F(%d, x, y):\n", n)
        fmt.Println("y/x    0   1   2   3   4   5")
        fmt.Println("----------------------------")
        for y := 0; y < 7; y++ {
            fmt.Printf("%d  |", y)
            for x := 0; x < 6; x++ {
                fmt.Printf("%4d", F(n, x, y))
            }
            fmt.Println()
        }
        fmt.Println()
    }
    fmt.Printf("F(2, 1, 1) = %d\n", F(2, 1, 1))
    fmt.Printf("F(3, 1, 1) = %d\n", F(3, 1, 1))
    fmt.Printf("F(2, 2, 1) = %d\n", F(2, 2, 1))
}

Java: 

public class Main {

  private static int F(int n,int x,int y) {
  	if (n == 0) {
    	return x + y;
  	}
 
 	 else if (y == 0) {
    	return x;
  	}
 
  	return F(n - 1, F(n, x, y - 1), F(n, x, y - 1) + y);
 }

  public static void main(String[] args) {
    System.out.println("F(1,3,3) = " + F(1,3,3));
  }
}
Task: Sudan function
Java: 

public class Main {

  private static int F(int n,int x,int y) {
  	if (n == 0) {
    	return x + y;
  	}
 
 	 else if (y == 0) {
    	return x;
  	}
 
  	return F(n - 1, F(n, x, y - 1), F(n, x, y - 1) + y);
 }

  public static void main(String[] args) {
    System.out.println("F(1,3,3) = " + F(1,3,3));
  }
}

Python: 

def F(n,x,y):
  if n==0:
    return x + y
  elif y==0:
    return x
  else:
    return F(n - 1, F(n, x, y - 1), F(n, x, y - 1) + y)
    
    
print("F(1,3,3) = ", F(1,3,3))
Task: Sudan function
Go: package main

import "fmt"

func F(n, x, y int) int {
    if n == 0 {
        return x + y
    }
    if y == 0 {
        return x
    }
    return F(n-1, F(n, x, y-1), F(n, x, y-1)+y)
}

func main() {
    for n := 0; n < 2; n++ {
        fmt.Printf("Values of F(%d, x, y):\n", n)
        fmt.Println("y/x    0   1   2   3   4   5")
        fmt.Println("----------------------------")
        for y := 0; y < 7; y++ {
            fmt.Printf("%d  |", y)
            for x := 0; x < 6; x++ {
                fmt.Printf("%4d", F(n, x, y))
            }
            fmt.Println()
        }
        fmt.Println()
    }
    fmt.Printf("F(2, 1, 1) = %d\n", F(2, 1, 1))
    fmt.Printf("F(3, 1, 1) = %d\n", F(3, 1, 1))
    fmt.Printf("F(2, 2, 1) = %d\n", F(2, 2, 1))
}

Python: 

def F(n,x,y):
  if n==0:
    return x + y
  elif y==0:
    return x
  else:
    return F(n - 1, F(n, x, y - 1), F(n, x, y - 1) + y)
    
    
print("F(1,3,3) = ", F(1,3,3))
Task: Sudan function
C: 

#include <stdio.h>

int F(int n,int x,int y) {
  if (n == 0) {
    return x + y;
  }
 
  else if (y == 0) {
    return x;
  }
 
  return F(n - 1, F(n, x, y - 1), F(n, x, y - 1) + y);
}

int main() {
  printf("F1(3,3) = %d",F(1,3,3));
  return 0;
}

Java: 

public class Main {

  private static int F(int n,int x,int y) {
  	if (n == 0) {
    	return x + y;
  	}
 
 	 else if (y == 0) {
    	return x;
  	}
 
  	return F(n - 1, F(n, x, y - 1), F(n, x, y - 1) + y);
 }

  public static void main(String[] args) {
    System.out.println("F(1,3,3) = " + F(1,3,3));
  }
}
Task: Sudan function
C#: 

using System;

namespace Sudan
{
  class Sudan
  {
  	static int F(int n,int x,int y) {
  		if (n == 0) {
    		return x + y;
  		}
 
  		else if (y == 0) {
    		return x;
  		}
 
  		return F(n - 1, F(n, x, y - 1), F(n, x, y - 1) + y);
	}
    
    static void Main(string[] args)
    {
      Console.WriteLine("F(1,3,3) = " + F(1,3,3));    
    }
  }
}

C++: 

#include <iostream>
using namespace std;

int F(int n,int x,int y) {
  if (n == 0) {
    return x + y;
  }
 
  else if (y == 0) {
    return x;
  }
 
  return F(n - 1, F(n, x, y - 1), F(n, x, y - 1) + y);
}

int main() {
  cout << "F(1,3,3) = "<<F(1,3,3)<<endl;
  return 0;
}
Task: Sudan function
C++: 

#include <iostream>
using namespace std;

int F(int n,int x,int y) {
  if (n == 0) {
    return x + y;
  }
 
  else if (y == 0) {
    return x;
  }
 
  return F(n - 1, F(n, x, y - 1), F(n, x, y - 1) + y);
}

int main() {
  cout << "F(1,3,3) = "<<F(1,3,3)<<endl;
  return 0;
}

Java: 

public class Main {

  private static int F(int n,int x,int y) {
  	if (n == 0) {
    	return x + y;
  	}
 
 	 else if (y == 0) {
    	return x;
  	}
 
  	return F(n - 1, F(n, x, y - 1), F(n, x, y - 1) + y);
 }

  public static void main(String[] args) {
    System.out.println("F(1,3,3) = " + F(1,3,3));
  }
}
Task: Sudan function
C: 

#include <stdio.h>

int F(int n,int x,int y) {
  if (n == 0) {
    return x + y;
  }
 
  else if (y == 0) {
    return x;
  }
 
  return F(n - 1, F(n, x, y - 1), F(n, x, y - 1) + y);
}

int main() {
  printf("F1(3,3) = %d",F(1,3,3));
  return 0;
}

PHP: #Aamrun , 11th July 2022

<?php
function F(int $n,int $x,int $y) {
  if ($n == 0) {
    return $x + $y;
  }
 
  else if ($y == 0) {
    return $x;
  }
 
  return F($n - 1, F($n, $x, $y - 1), F($n, $x, $y - 1) + $y);
}
echo "F(1,3,3) = " . F(1,3,3); 
?>
Task: Sudan function
C#: 

using System;

namespace Sudan
{
  class Sudan
  {
  	static int F(int n,int x,int y) {
  		if (n == 0) {
    		return x + y;
  		}
 
  		else if (y == 0) {
    		return x;
  		}
 
  		return F(n - 1, F(n, x, y - 1), F(n, x, y - 1) + y);
	}
    
    static void Main(string[] args)
    {
      Console.WriteLine("F(1,3,3) = " + F(1,3,3));    
    }
  }
}

PHP: #Aamrun , 11th July 2022

<?php
function F(int $n,int $x,int $y) {
  if ($n == 0) {
    return $x + $y;
  }
 
  else if ($y == 0) {
    return $x;
  }
 
  return F($n - 1, F($n, $x, $y - 1), F($n, $x, $y - 1) + $y);
}
echo "F(1,3,3) = " . F(1,3,3); 
?>
Task: Sudan function
C++: 

#include <iostream>
using namespace std;

int F(int n,int x,int y) {
  if (n == 0) {
    return x + y;
  }
 
  else if (y == 0) {
    return x;
  }
 
  return F(n - 1, F(n, x, y - 1), F(n, x, y - 1) + y);
}

int main() {
  cout << "F(1,3,3) = "<<F(1,3,3)<<endl;
  return 0;
}

PHP: #Aamrun , 11th July 2022

<?php
function F(int $n,int $x,int $y) {
  if ($n == 0) {
    return $x + $y;
  }
 
  else if ($y == 0) {
    return $x;
  }
 
  return F($n - 1, F($n, $x, $y - 1), F($n, $x, $y - 1) + $y);
}
echo "F(1,3,3) = " . F(1,3,3); 
?>
Task: Sudan function
Go: package main

import "fmt"

func F(n, x, y int) int {
    if n == 0 {
        return x + y
    }
    if y == 0 {
        return x
    }
    return F(n-1, F(n, x, y-1), F(n, x, y-1)+y)
}

func main() {
    for n := 0; n < 2; n++ {
        fmt.Printf("Values of F(%d, x, y):\n", n)
        fmt.Println("y/x    0   1   2   3   4   5")
        fmt.Println("----------------------------")
        for y := 0; y < 7; y++ {
            fmt.Printf("%d  |", y)
            for x := 0; x < 6; x++ {
                fmt.Printf("%4d", F(n, x, y))
            }
            fmt.Println()
        }
        fmt.Println()
    }
    fmt.Printf("F(2, 1, 1) = %d\n", F(2, 1, 1))
    fmt.Printf("F(3, 1, 1) = %d\n", F(3, 1, 1))
    fmt.Printf("F(2, 2, 1) = %d\n", F(2, 2, 1))
}

PHP: #Aamrun , 11th July 2022

<?php
function F(int $n,int $x,int $y) {
  if ($n == 0) {
    return $x + $y;
  }
 
  else if ($y == 0) {
    return $x;
  }
 
  return F($n - 1, F($n, $x, $y - 1), F($n, $x, $y - 1) + $y);
}
echo "F(1,3,3) = " . F(1,3,3); 
?>
Task: Sudan function
Java: 

public class Main {

  private static int F(int n,int x,int y) {
  	if (n == 0) {
    	return x + y;
  	}
 
 	 else if (y == 0) {
    	return x;
  	}
 
  	return F(n - 1, F(n, x, y - 1), F(n, x, y - 1) + y);
 }

  public static void main(String[] args) {
    System.out.println("F(1,3,3) = " + F(1,3,3));
  }
}

PHP: #Aamrun , 11th July 2022

<?php
function F(int $n,int $x,int $y) {
  if ($n == 0) {
    return $x + $y;
  }
 
  else if ($y == 0) {
    return $x;
  }
 
  return F($n - 1, F($n, $x, $y - 1), F($n, $x, $y - 1) + $y);
}
echo "F(1,3,3) = " . F(1,3,3); 
?>
Task: Sudan function
Python: 

def F(n,x,y):
  if n==0:
    return x + y
  elif y==0:
    return x
  else:
    return F(n - 1, F(n, x, y - 1), F(n, x, y - 1) + y)
    
    
print("F(1,3,3) = ", F(1,3,3))

PHP: #Aamrun , 11th July 2022

<?php
function F(int $n,int $x,int $y) {
  if ($n == 0) {
    return $x + $y;
  }
 
  else if ($y == 0) {
    return $x;
  }
 
  return F($n - 1, F($n, $x, $y - 1), F($n, $x, $y - 1) + $y);
}
echo "F(1,3,3) = " . F(1,3,3); 
?>
Task: Sudan function
VB: Function F(n As Integer, x As Integer, y As Integer) As Integer 
  
  If n = 0 Then Return x + y 
  If y = 0 Then Return x 
  Return F(n - 1, F(n, x, y - 1), F(n, x, y - 1) + y) 
  
End Function

Public Sub Main() 
  
  Dim n, x, y As Integer

  For n = 0 To 1 
    Print " Values of F(" & n & ", x, y):" 
    Print " y/x    0   1   2   3   4   5" 
    Print String(29, "-") 
    For y = 0 To 6 
      Print y; "  | "; 
      For x = 0 To 5 
        Print Format$(F(n, x, y), "####"); 
      Next 
      Print 
    Next 
    Print 
  Next 
  
  Print "F(2,1,1) = "; F(2, 1, 1) 
  Print "F(3,1,1) = "; F(3, 1, 1) 
  Print "F(2,2,1) = "; F(2, 2, 1)
  
End

PHP: #Aamrun , 11th July 2022

<?php
function F(int $n,int $x,int $y) {
  if ($n == 0) {
    return $x + $y;
  }
 
  else if ($y == 0) {
    return $x;
  }
 
  return F($n - 1, F($n, $x, $y - 1), F($n, $x, $y - 1) + $y);
}
echo "F(1,3,3) = " . F(1,3,3); 
?>
Task: Copy a string
C: #include <stdlib.h>	
#include <stdio.h>	
#include <string.h>

int
main()
{
	size_t len;
	char src[] = "Hello";
	char dst1[80], dst2[80];
	char *dst3, *ref;

	
	strcpy(dst1, src);

	
	len = strlen(src);
	if (len >= sizeof dst2) {
		fputs("The buffer is too small!\n", stderr);
		exit(1);
	}
	memcpy(dst2, src, len + 1);

	
	dst3 = strdup(src);
	if (dst3 == NULL) {
		
		perror("strdup");
		exit(1);
	}

	
	ref = src;

	
	memset(src, '-', 5);

	printf(" src: %s\n", src);   
	printf("dst1: %s\n", dst1);  
	printf("dst2: %s\n", dst2);  
	printf("dst3: %s\n", dst3);  
	printf(" ref: %s\n", ref);   

	
	free(dst3);

	return 0;
}

C#: string src = "Hello";
string dst = src;
Task: Copy a string
C: #include <stdlib.h>	
#include <stdio.h>	
#include <string.h>

int
main()
{
	size_t len;
	char src[] = "Hello";
	char dst1[80], dst2[80];
	char *dst3, *ref;

	
	strcpy(dst1, src);

	
	len = strlen(src);
	if (len >= sizeof dst2) {
		fputs("The buffer is too small!\n", stderr);
		exit(1);
	}
	memcpy(dst2, src, len + 1);

	
	dst3 = strdup(src);
	if (dst3 == NULL) {
		
		perror("strdup");
		exit(1);
	}

	
	ref = src;

	
	memset(src, '-', 5);

	printf(" src: %s\n", src);   
	printf("dst1: %s\n", dst1);  
	printf("dst2: %s\n", dst2);  
	printf("dst3: %s\n", dst3);  
	printf(" ref: %s\n", ref);   

	
	free(dst3);

	return 0;
}

C++: #include <iostream>
#include <string>

int main( ) {
   std::string original ("This is the original");
   std::string my_copy = original;
   std::cout << "This is the copy: " << my_copy << std::endl;
   original = "Now we change the original! ";
   std::cout << "my_copy still is " << my_copy << std::endl;
}
Task: Copy a string
C: #include <stdlib.h>	
#include <stdio.h>	
#include <string.h>

int
main()
{
	size_t len;
	char src[] = "Hello";
	char dst1[80], dst2[80];
	char *dst3, *ref;

	
	strcpy(dst1, src);

	
	len = strlen(src);
	if (len >= sizeof dst2) {
		fputs("The buffer is too small!\n", stderr);
		exit(1);
	}
	memcpy(dst2, src, len + 1);

	
	dst3 = strdup(src);
	if (dst3 == NULL) {
		
		perror("strdup");
		exit(1);
	}

	
	ref = src;

	
	memset(src, '-', 5);

	printf(" src: %s\n", src);   
	printf("dst1: %s\n", dst1);  
	printf("dst2: %s\n", dst2);  
	printf("dst3: %s\n", dst3);  
	printf(" ref: %s\n", ref);   

	
	free(dst3);

	return 0;
}

Go: src := "Hello"
dst := src
Task: Copy a string
C: #include <stdlib.h>	
#include <stdio.h>	
#include <string.h>

int
main()
{
	size_t len;
	char src[] = "Hello";
	char dst1[80], dst2[80];
	char *dst3, *ref;

	
	strcpy(dst1, src);

	
	len = strlen(src);
	if (len >= sizeof dst2) {
		fputs("The buffer is too small!\n", stderr);
		exit(1);
	}
	memcpy(dst2, src, len + 1);

	
	dst3 = strdup(src);
	if (dst3 == NULL) {
		
		perror("strdup");
		exit(1);
	}

	
	ref = src;

	
	memset(src, '-', 5);

	printf(" src: %s\n", src);   
	printf("dst1: %s\n", dst1);  
	printf("dst2: %s\n", dst2);  
	printf("dst3: %s\n", dst3);  
	printf(" ref: %s\n", ref);   

	
	free(dst3);

	return 0;
}

Java: String src = "Hello";
String newAlias = src;
String strCopy = new String(src);
Task: Copy a string
C: #include <stdlib.h>	
#include <stdio.h>	
#include <string.h>

int
main()
{
	size_t len;
	char src[] = "Hello";
	char dst1[80], dst2[80];
	char *dst3, *ref;

	
	strcpy(dst1, src);

	
	len = strlen(src);
	if (len >= sizeof dst2) {
		fputs("The buffer is too small!\n", stderr);
		exit(1);
	}
	memcpy(dst2, src, len + 1);

	
	dst3 = strdup(src);
	if (dst3 == NULL) {
		
		perror("strdup");
		exit(1);
	}

	
	ref = src;

	
	memset(src, '-', 5);

	printf(" src: %s\n", src);   
	printf("dst1: %s\n", dst1);  
	printf("dst2: %s\n", dst2);  
	printf("dst3: %s\n", dst3);  
	printf(" ref: %s\n", ref);   

	
	free(dst3);

	return 0;
}

Python: >>> src = "hello"
>>> a = src
>>> b = src[:]
>>> import copy
>>> c = copy.copy(src)
>>> d = copy.deepcopy(src)
>>> src is a is b is c is d
True
Task: Copy a string
C: #include <stdlib.h>	
#include <stdio.h>	
#include <string.h>

int
main()
{
	size_t len;
	char src[] = "Hello";
	char dst1[80], dst2[80];
	char *dst3, *ref;

	
	strcpy(dst1, src);

	
	len = strlen(src);
	if (len >= sizeof dst2) {
		fputs("The buffer is too small!\n", stderr);
		exit(1);
	}
	memcpy(dst2, src, len + 1);

	
	dst3 = strdup(src);
	if (dst3 == NULL) {
		
		perror("strdup");
		exit(1);
	}

	
	ref = src;

	
	memset(src, '-', 5);

	printf(" src: %s\n", src);   
	printf("dst1: %s\n", dst1);  
	printf("dst2: %s\n", dst2);  
	printf("dst3: %s\n", dst3);  
	printf(" ref: %s\n", ref);   

	
	free(dst3);

	return 0;
}

VB: Sub copystring()
    a = "Hello World!"
    b = a
    a = "I
    Debug.Print b
    Debug.Print a
End Sub
Task: Copy a string
C#: string src = "Hello";
string dst = src;

C++: #include <iostream>
#include <string>

int main( ) {
   std::string original ("This is the original");
   std::string my_copy = original;
   std::cout << "This is the copy: " << my_copy << std::endl;
   original = "Now we change the original! ";
   std::cout << "my_copy still is " << my_copy << std::endl;
}
Task: Copy a string
C++: #include <iostream>
#include <string>

int main( ) {
   std::string original ("This is the original");
   std::string my_copy = original;
   std::cout << "This is the copy: " << my_copy << std::endl;
   original = "Now we change the original! ";
   std::cout << "my_copy still is " << my_copy << std::endl;
}

Go: src := "Hello"
dst := src
Task: Copy a string
C++: #include <iostream>
#include <string>

int main( ) {
   std::string original ("This is the original");
   std::string my_copy = original;
   std::cout << "This is the copy: " << my_copy << std::endl;
   original = "Now we change the original! ";
   std::cout << "my_copy still is " << my_copy << std::endl;
}

Java: String src = "Hello";
String newAlias = src;
String strCopy = new String(src);
Task: Copy a string
C++: #include <iostream>
#include <string>

int main( ) {
   std::string original ("This is the original");
   std::string my_copy = original;
   std::cout << "This is the copy: " << my_copy << std::endl;
   original = "Now we change the original! ";
   std::cout << "my_copy still is " << my_copy << std::endl;
}

Python: >>> src = "hello"
>>> a = src
>>> b = src[:]
>>> import copy
>>> c = copy.copy(src)
>>> d = copy.deepcopy(src)
>>> src is a is b is c is d
True
Task: Copy a string
C++: #include <iostream>
#include <string>

int main( ) {
   std::string original ("This is the original");
   std::string my_copy = original;
   std::cout << "This is the copy: " << my_copy << std::endl;
   original = "Now we change the original! ";
   std::cout << "my_copy still is " << my_copy << std::endl;
}

VB: Sub copystring()
    a = "Hello World!"
    b = a
    a = "I
    Debug.Print b
    Debug.Print a
End Sub
Task: Copy a string
C#: string src = "Hello";
string dst = src;

Python: >>> src = "hello"
>>> a = src
>>> b = src[:]
>>> import copy
>>> c = copy.copy(src)
>>> d = copy.deepcopy(src)
>>> src is a is b is c is d
True
Task: Copy a string
Go: src := "Hello"
dst := src

VB: Sub copystring()
    a = "Hello World!"
    b = a
    a = "I
    Debug.Print b
    Debug.Print a
End Sub
Task: Copy a string
C#: string src = "Hello";
string dst = src;

Java: String src = "Hello";
String newAlias = src;
String strCopy = new String(src);
Task: Copy a string
C#: string src = "Hello";
string dst = src;

VB: Sub copystring()
    a = "Hello World!"
    b = a
    a = "I
    Debug.Print b
    Debug.Print a
End Sub
Task: Copy a string
Java: String src = "Hello";
String newAlias = src;
String strCopy = new String(src);





Python: >>> src = "hello"
>>> a = src
>>> b = src[:]
>>> import copy
>>> c = copy.copy(src)
>>> d = copy.deepcopy(src)
>>> src is a is b is c is d
True
Task: Copy a string
Java: String src = "Hello";
String newAlias = src;
String strCopy = new String(src);





VB: Sub copystring()
    a = "Hello World!"
    b = a
    a = "I
    Debug.Print b
    Debug.Print a
End Sub
Task: Copy a string
Go: src := "Hello"
dst := src

Python: >>> src = "hello"
>>> a = src
>>> b = src[:]
>>> import copy
>>> c = copy.copy(src)
>>> d = copy.deepcopy(src)
>>> src is a is b is c is d
True
Task: Copy a string
Python: >>> src = "hello"
>>> a = src
>>> b = src[:]
>>> import copy
>>> c = copy.copy(src)
>>> d = copy.deepcopy(src)
>>> src is a is b is c is d
True

VB: Sub copystring()
    a = "Hello World!"
    b = a
    a = "I
    Debug.Print b
    Debug.Print a
End Sub
Task: Copy a string
C: #include <stdlib.h>	
#include <stdio.h>	
#include <string.h>

int
main()
{
	size_t len;
	char src[] = "Hello";
	char dst1[80], dst2[80];
	char *dst3, *ref;

	
	strcpy(dst1, src);

	
	len = strlen(src);
	if (len >= sizeof dst2) {
		fputs("The buffer is too small!\n", stderr);
		exit(1);
	}
	memcpy(dst2, src, len + 1);

	
	dst3 = strdup(src);
	if (dst3 == NULL) {
		
		perror("strdup");
		exit(1);
	}

	
	ref = src;

	
	memset(src, '-', 5);

	printf(" src: %s\n", src);   
	printf("dst1: %s\n", dst1);  
	printf("dst2: %s\n", dst2);  
	printf("dst3: %s\n", dst3);  
	printf(" ref: %s\n", ref);   

	
	free(dst3);

	return 0;
}

PHP: $src = "Hello";
$dst = $src;
Task: Copy a string
C++: #include <iostream>
#include <string>

int main( ) {
   std::string original ("This is the original");
   std::string my_copy = original;
   std::cout << "This is the copy: " << my_copy << std::endl;
   original = "Now we change the original! ";
   std::cout << "my_copy still is " << my_copy << std::endl;
}

PHP: $src = "Hello";
$dst = $src;
Task: Copy a string
Java: String src = "Hello";
String newAlias = src;
String strCopy = new String(src);





PHP: $src = "Hello";
$dst = $src;
Task: Copy a string
Python: >>> src = "hello"
>>> a = src
>>> b = src[:]
>>> import copy
>>> c = copy.copy(src)
>>> d = copy.deepcopy(src)
>>> src is a is b is c is d
True

PHP: $src = "Hello";
$dst = $src;
Task: Copy a string
VB: Sub copystring()
    a = "Hello World!"
    b = a
    a = "I
    Debug.Print b
    Debug.Print a
End Sub

PHP: $src = "Hello";
$dst = $src;
Task: Sum digits of an integer
C: #include <stdio.h>

int SumDigits(unsigned long long n, const int base) {
    int sum = 0;
    for (; n; n /= base)
    	sum += n % base;
    return sum;
}
 
int main() {
    printf("%d %d %d %d %d\n",
        SumDigits(1, 10),
        SumDigits(12345, 10),
        SumDigits(123045, 10),
        SumDigits(0xfe, 16),
        SumDigits(0xf0e, 16) );
    return 0;
}

C#: namespace RosettaCode.SumDigitsOfAnInteger
{
    using System;
    using System.Collections.Generic;
    using System.Linq;

    internal static class Program
    {
        
        
        
        
        
        
        
        
        
        private static IEnumerable<int> Digits(this int number, int @base = 10)
        {
            while (number != 0)
            {
                int digit;
                number = Math.DivRem(number, @base, out digit);
                yield return digit;
            }
        }

        
        
        
        
        
        
        private static int SumOfDigits(this int number, int @base = 10)
        {
            return number.Digits(@base).Sum();
        }

        
        
        
        private static void Main()
        {
            foreach (var example in
                new[]
                {
                    new {Number = 1, Base = 10},
                    new {Number = 12345, Base = 10},
                    new {Number = 123045, Base = 10},
                    new {Number = 0xfe, Base = 0x10},
                    new {Number = 0xf0e, Base = 0x10}
                })
            {
                Console.WriteLine(example.Number.SumOfDigits(example.Base));
            }
        }
    }
}
Task: Sum digits of an integer
C: #include <stdio.h>

int SumDigits(unsigned long long n, const int base) {
    int sum = 0;
    for (; n; n /= base)
    	sum += n % base;
    return sum;
}
 
int main() {
    printf("%d %d %d %d %d\n",
        SumDigits(1, 10),
        SumDigits(12345, 10),
        SumDigits(123045, 10),
        SumDigits(0xfe, 16),
        SumDigits(0xf0e, 16) );
    return 0;
}

C++: #include <iostream>
#include <cmath>
int SumDigits(const unsigned long long int digits, const int BASE = 10) {
    int sum = 0;
    unsigned long long int x = digits;
    for (int i = log(digits)/log(BASE); i>0; i--){
        const double z = std::pow(BASE,i);
	  const unsigned long long int t = x/z;
	  sum += t;
	  x -= t*z;
    }
    return x+sum;
}

int main() {
        std::cout << SumDigits(1) << ' '
                  << SumDigits(12345) << ' '
                  << SumDigits(123045) << ' '
                  << SumDigits(0xfe, 16) << ' '
                  << SumDigits(0xf0e, 16) << std::endl;
        return 0;
}
Task: Sum digits of an integer
C: #include <stdio.h>

int SumDigits(unsigned long long n, const int base) {
    int sum = 0;
    for (; n; n /= base)
    	sum += n % base;
    return sum;
}
 
int main() {
    printf("%d %d %d %d %d\n",
        SumDigits(1, 10),
        SumDigits(12345, 10),
        SumDigits(123045, 10),
        SumDigits(0xfe, 16),
        SumDigits(0xf0e, 16) );
    return 0;
}

Go: 

package digit

import (
	"math/big"
	"strconv"
)

func SumString(n string, base int) (int, error) {
	i, ok := new(big.Int).SetString(n, base)
	if !ok {
		return 0, strconv.ErrSyntax
	}
	if i.Sign() < 0 {
		return 0, strconv.ErrRange
	}
	if i.BitLen() <= 64 {
		return Sum(i.Uint64(), base), nil
	}
	return SumBig(i, base), nil
}

func Sum(i uint64, base int) (sum int) {
	b64 := uint64(base)
	for ; i > 0; i /= b64 {
		sum += int(i % b64)
	}
	return
}

func SumBig(n *big.Int, base int) (sum int) {
	i := new(big.Int).Set(n)
	b := new(big.Int).SetUint64(uint64(base))
	r := new(big.Int)
	for i.BitLen() > 0 {
		i.DivMod(i, b, r)
		sum += int(r.Uint64())
	}
	return
}