You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
969 B
Plaintext
47 lines
969 B
Plaintext
using System;
|
|
|
|
namespace Rekursion
|
|
{
|
|
class RekursiveBerechnung
|
|
{
|
|
|
|
public int addiereSummanden(int a, int b)
|
|
{
|
|
if (b == 0 && a == 0)
|
|
{
|
|
|
|
return 0;
|
|
}
|
|
else if (a == 0)
|
|
{
|
|
return 1 + addiereSummanden(0, b - 1);
|
|
}
|
|
else
|
|
{
|
|
return 1 + addiereSummanden(a - 1, b);
|
|
}
|
|
}
|
|
|
|
public int multipliziereFaktoren(int a, int b)
|
|
{
|
|
{
|
|
if (a == 0 || b == 0)
|
|
{
|
|
return 0;
|
|
}
|
|
else
|
|
{
|
|
return addiereSummanden(a, multipliziereFaktoren(a, b - 1));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
class Program
|
|
{
|
|
static void Main(string[] args)
|
|
{
|
|
Console.WriteLine("Bitte wählen Sie aus, was Sie tun möchten: ");
|
|
}
|
|
}
|
|
} |