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.
73 lines
1.8 KiB
Plaintext
73 lines
1.8 KiB
Plaintext
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);
|
|
|
|
querSumme = 0;
|
|
return querSumme;
|
|
}
|
|
|
|
public int pruefeSeriennummer(string seriennummer)
|
|
{
|
|
// Buchstaben durch Zahl ersetzen (Grundlage: ASCII zuordnung)
|
|
char[] seriennummerChar = seriennummer.ToCharArray(0,12);
|
|
|
|
int positionszahl = seriennummerChar[0] - 64;
|
|
seriennummerChar[0] = Convert.ToChar(positionszahl);
|
|
|
|
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 quersumme = 2;
|
|
//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);
|
|
}
|
|
}
|
|
}
|
|
|