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.
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace Klausur07122016_3
|
|
|
|
|
{
|
|
|
|
|
class Program
|
|
|
|
|
{
|
|
|
|
|
static void Main(string[] args)
|
|
|
|
|
{
|
|
|
|
|
//Aufgabe 3) Array mit Prüfzigger25
|
|
|
|
|
//erstellt von Alexander Degen BS IT16
|
|
|
|
|
|
|
|
|
|
//Deklaration der Variablen
|
|
|
|
|
int[] feld2D = { 37, 3, 68, 25, 10, 49, 55, 22, 9, 27, 27, 69, 34, 85, 13, 73, 0 };
|
|
|
|
|
int summefeld2D = 0;
|
|
|
|
|
int prüfziffer = 0;
|
|
|
|
|
|
|
|
|
|
//Header
|
|
|
|
|
Console.WriteLine("---Array mit Prüfziffer25(feld2D)--- \n\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Array-Handling
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < feld2D.GetLength(0); i++)
|
|
|
|
|
{
|
|
|
|
|
summefeld2D += feld2D[i];
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
prüfziffer = 100 - (summefeld2D % 100);
|
|
|
|
|
|
|
|
|
|
feld2D[feld2D.GetLength(0) -1 ] = prüfziffer;
|
|
|
|
|
|
|
|
|
|
//Ausgabe
|
|
|
|
|
Console.Write("\n feld2D : ");
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < feld2D.GetLength(0); i++)
|
|
|
|
|
Console.Write(feld2D[i]+ " ");
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("\n Summer der Feldinhalte von feld2D : " +summefeld2D);
|
|
|
|
|
Console.WriteLine("\n Prüfziffer: " + prüfziffer);
|
|
|
|
|
|
|
|
|
|
Console.ReadLine();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|