|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Text;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
namespace ConsoleApplication9
|
|
|
|
{
|
|
|
|
class BanknotePruefen
|
|
|
|
{
|
|
|
|
// Helferfunktion zur Berechnung der Quersumme
|
|
|
|
public static int QuerSumme(int zahl)
|
|
|
|
{
|
|
|
|
int querSumme = 0;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
querSumme += zahl % 10;
|
|
|
|
zahl /= 10;
|
|
|
|
} while (zahl > 0);
|
|
|
|
|
|
|
|
return querSumme;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int pruefeSeriennummer(string seriennummer)
|
|
|
|
{
|
|
|
|
// Buchstaben durch Zahl ersetzen (Grundlage: ASCII zuordnung)
|
|
|
|
char[] seriennummerChar = seriennummer.ToCharArray(0, 12);
|
|
|
|
|
|
|
|
int positionszahl = (int)seriennummerChar[0] - 64;
|
|
|
|
int q1 = QuerSumme(positionszahl);
|
|
|
|
|
|
|
|
Console.WriteLine(Convert.ToString(q1));
|
|
|
|
|
|
|
|
string snqs = new string(seriennummerChar);
|
|
|
|
|
|
|
|
Console.WriteLine(snqs + "\r\n");
|
|
|
|
|
|
|
|
int quersumme = 0;
|
|
|
|
|
|
|
|
Console.WriteLine(Convert.ToString(seriennummerChar[0] + "!!!! \r\n"));
|
|
|
|
|
|
|
|
for (int i = 0; i <= 10; i++)
|
|
|
|
{
|
|
|
|
|
|
|
|
Console.WriteLine(seriennummerChar[i] + "\r\n \r\n");
|
|
|
|
|
|
|
|
quersumme += Convert.ToInt32(seriennummerChar[i]);
|
|
|
|
|
|
|
|
Console.WriteLine(Convert.ToString(quersumme));
|
|
|
|
}
|
|
|
|
|
|
|
|
//int subtrahend = (quersumme % 9);
|
|
|
|
//int result = 8 - subtrahend;
|
|
|
|
//if (result == 0) result = 9;
|
|
|
|
|
|
|
|
return positionszahl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class Program
|
|
|
|
{
|
|
|
|
static void Main(string[] args)
|
|
|
|
{
|
|
|
|
BanknotePruefen bp = new BanknotePruefen();
|
|
|
|
|
|
|
|
string seriennummer = Console.ReadLine();
|
|
|
|
int erg = bp.pruefeSeriennummer(seriennummer);
|
|
|
|
|
|
|
|
Console.WriteLine(erg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|